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

Teradata® Python Package Function Reference

Product
Teradata Python Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-07-17
lifecycle
previous
Product Category
Teradata Vantage
teradataml.dataframe.dataframe.DataFrame.groupby = groupby(self, columns_expr)
DESCRIPTION:
    Apply GroupBy to one or more columns of a teradataml Dataframe
    The result will always behaves like calling groupby with as_index = False in pandas
 
PARAMETERS:
    columns_expr:
        Required Argument.
        Specifies the column name(s) to group by.
        Types: str OR list of Strings (str)
 
NOTES:
    1. Users can still apply teradataml DataFrame methods (filters/sort/etc) on top of the result.
    2. Consecutive operations of grouping, i.e., groupby_time(), resample() and groupby() are not permitted.
       An exception will be raised. Following are some cases where exception will be raised as
       "Invalid operation applied, check documentation for correct usage."
            a. df.resample().groupby()
            b. df.resample().resample()
            c. df.resample().groupby_time()
 
RETURNS:
    teradataml DataFrameGroupBy Object
 
RAISES:
    TeradataMlException
 
EXAMPLES:
    >>> load_example_data("dataframe","admissions_train")
    >>> df = DataFrame("admissions_train")
    >>> df1 = df.groupby(["masters"])
    >>> df1.min()
      masters min_id  min_gpa min_stats min_programming min_admitted
    0      no      3     1.87  Advanced        Advanced            0
    1     yes      1     1.98  Advanced        Advanced            0