Teradata Package for Python Function Reference | 17.10 - __getitem__ - Teradata Package for Python
Teradata® Package for Python Function Reference
- Product
- Teradata Package for Python
- Release Number
- 17.10
- Published
- April 2022
- Language
- English (United States)
- Last Update
- 2022-08-19
- Product Category
- Teradata Vantage
- teradataml.geospatial.geodataframe.GeoDataFrame.__getitem__ = __getitem__(self, key)
- Return a column from the GeoDataFrame or filter the GeoDataFrame using an expression.
The following operators are supported:
comparison: ==, !=, <, <=, >, >=
boolean: & (and), | (or), ~ (not), ^ (xor)
Operands can be Python literals and instances of ColumnExpressions from the GeoDataFrame.
PARAMETERS:
key:
Required Argument.
Specifies a column name as a string or filter expression (ColumnExpression).
Types: ColumnExpression
RETURNS:
GeoDataFrame or ColumnExpression instance
RAISES:
1. KeyError - If key is not found
2. ValueError - When columns of different GeoDataFrames are given in ColumnExpression.
EXAMPLES:
gdf = GeoDataFrame('table')
# filter the GeoDataFrame gdf
gdf[gdf.c1 > gdf.c2]
gdf[gdf.c1 >= 1]
gdf[gdf.c1 == 'string']
gdf[1 != gdf.c2]
gdf[~(1 < gdf.c2)]
gdf[(gdf.c1 > 0) & (gdf.c2 > gdf.c1)]
# retrieve column c1 from df
gdf['c1']