Teradata Package for Python Function Reference | 20.00 - rollup - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.

Teradata® Package for Python Function Reference - 20.00

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for Python
Release Number
20.00.00.03
Published
December 2024
ft:locale
en-US
ft:lastEdition
2024-12-19
dita:id
TeradataPython_FxRef_Enterprise_2000
Product Category
Teradata Vantage
teradataml.dataframe.dataframe.DataFrame.rollup = rollup(self, columns)
DESCRIPTION:
    rollup() function creates a multi-dimensional rollup for the DataFrame
    using the specified column(s), and there by running aggregates on
    it to produce the aggregations on different dimensions.
 
 
PARAMETERS:
    columns:
        Required Argument.
        Specifies the name(s) of input teradataml DataFrame column(s).
        Types: str OR list of str(s)
 
RETURNS:
    teradataml DataFrameGroupBy
 
RAISES:
    TeradataMlException
 
EXAMPLES :
    # Example 1: Analyzes the data by grouping into masters and stats dimensions.
    >>> load_example_data("dataframe","admissions_train")
    >>> df = DataFrame("admissions_train")
    >>> df1 = df.rollup(["masters", "stats"]).sum()
    >>> df1
      masters     stats  sum_id  sum_gpa  sum_admitted
    0      no      None     343    63.96            16
    1     yes      None     477    77.71            10
    2    None      None     820   141.67            26
    3      no    Novice     146    25.41             6
    4      no  Beginner       8     3.60             1
    5     yes    Novice      98    13.74             1
    6     yes  Beginner      13    14.71             2
    7     yes  Advanced     366    49.26             7
    8      no  Advanced     189    34.95             9