Teradata Package for Python Function Reference | 20.00 - get - 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
- lifecycle
- latest
- Product Category
- Teradata Vantage
- teradataml.geospatial.geodataframe.GeoDataFrame.get = get(self, key)
- DESCRIPTION:
Retrieve required columns from GeoDataFrame using column name(s) as key.
Returns a new teradataml GeoDataFrame with requested columns only.
PARAMETERS:
key:
Required Argument.
Specifies column(s) to retrieve from the teradataml GeoDataFrame.
Types: str OR List of Strings (str)
teradataml supports the following formats (only) for the "get" method:
1] Single Column String: df.get("col1")
2] Single Column List: df.get(["col1"])
3] Multi-Column List: df.get(['col1', 'col2', 'col3'])
4] Multi-Column List of List: df.get([["col1", "col2", "col3"]])
Note: Multi-Column retrieval of the same column such as df.get(['col1', 'col1']) is not supported.
RETURNS:
teradataml GeoDataFrame
RAISES:
TeradataMlException
EXAMPLES:
>>> load_example_data("geodataframe","sample_streets")
>>> df = GeoDataFrame('sample_streets')
>>> df
street_name street_shape
skey
1 Coast Blvd LINESTRING (12 12,18 17)
1 Main Street LINESTRING (2 2,3 2,4 1)
>>>
# Example 1: Column passed as single String Column
>>> df.get("skey")
Empty DataFrame
Columns: []
Index: [1, 1]
>>>
# Example 2: Column passed as single Column List
>>> df.get(["street_shape"])
street_shape
0 LINESTRING (12 12,18 17)
1 LINESTRING (2 2,3 2,4 1)
>>>
# Example 3: Columns passed as multi-Column List
>>> df.get(["skey", "street_shape"])
street_shape
skey
1 LINESTRING (12 12,18 17)
1 LINESTRING (2 2,3 2,4 1)
>>>
# Example 4: Column passed as multi-Column List of List
>>> df.get([["skey", "street_shape"]])
street_shape
skey
1 LINESTRING (12 12,18 17)
1 LINESTRING (2 2,3 2,4 1)
>>>