Teradata Package for Python Function Reference | 20.00 - groupby - 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.geospatial.geodataframe.GeoDataFrame.groupby = groupby(self, columns_expr)
- DESCRIPTION:
Applies GroupBy to one or more columns of a teradataml GeoDataFrame.
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 GeoDataFrame 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 GeoDataFrameGroupBy Object
RAISES:
TeradataMlException
EXAMPLES:
>>> load_example_data("geodataframe","sample_streets")
>>> df = GeoDataFrame("sample_streets")
>>> df1 = df.groupby(["street_shape"])
>>> df1.count()
street_shape count_skey count_street_name
0 LINESTRING (2 2,3 2,4 1) 1 1
1 LINESTRING (12 12,18 17) 1 1
>>>