Teradata Package for Python Function Reference | 17.10 - index - 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

Product
Teradata Package for Python
Release Number
17.10
Published
April 2022
Language
English (United States)
Last Update
2022-08-19
lifecycle
previous
Product Category
Teradata Vantage
teradataml.geospatial.geodataframe.GeoDataFrame.index
DESCRIPTION:
    Returns the index_label of the teradataml GeoDataFrame.
 
RETURNS:
    str or List of Strings (str) representing the index_label of the GeoDataFrame.
 
RAISES:
    None
 
EXAMPLES:
    >>> load_example_data("geodataframe","sample_cities")
    >>> df = GeoDataFrame("sample_cities")
    >>> df
           city_name                                 city_shape
    skey
    1        Seaside  POLYGON ((10 10,10 20,20 20,20 15,10 10))
    0     Oceanville            POLYGON ((1 1,1 3,6 3,6 0,1 1))
    >>>
    # Get the index_label
    >>> df.index
    ['skey']
    >>>
    # Set new index_label
    >>> df = df.set_index(['city_shape', 'city_name'])
    >>> df
                                                          skey
    city_name  city_shape
    Seaside    POLYGON ((10 10,10 20,20 20,20 15,10 10))     1
    Oceanville POLYGON ((1 1,1 3,6 3,6 0,1 1))               0
    >>>
    # Get the index_label
    >>> df.index
    ['city_name', 'city_shape']
    >>>