Teradata Package for Python Function Reference on VantageCloud Lake | 17.20 - from_table - 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 on VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Package for Python
Release Number
17.20
Publication Date
November 2022
Content Type
Programming Reference
Publication ID
B700-4500-112K
ft:locale
en-US
ft:lastEdition
2024-02-21
ft:sourceId
FTML
dita:id
TeradataPython_FxRef_Lake_1720
Product Category
Teradata Vantage
teradataml.geospatial.geodataframe.GeoDataFrame.from_table = from_table(table_name, index=True, index_label=None) method of builtins.type instance
Class method for creating a GeoDataFrame from a table or a view.
Note: 
    Use GeoDataFrame only when table or view contains a Geometry data, i.e., 
    column of teradatasqlalchemy types: Geometry(ST_Geometry in SQL), MBB, MBR.
    Otherwise, an exception is raised.
 
PARAMETERS:
    table_name:
        Required Argument.
        The table name in Teradata Vantage referenced by this GeoDataFrame.
        Types: str
 
    index:
        Optional Argument.
        True if using index column for sorting otherwise False.
        Default Value: True
        Types: bool
 
    index_label:
        Optional
        Column/s used for sorting.
        Types: str
        
RETURNS:
    GeoDataFrame
 
RAISES:
    TeradataMlException - TDMLDF_CREATE_FAIL
 
EXAMPLES:
    >>> from teradataml import GeoDataFrame
    >>> load_example_data("geodataframe","sample_streets")
    >>> gdf = GeoDataFrame.from_table('sample_streets')
    >>> gdf
          street_name              street_shape
    skey
    1      Coast Blvd  LINESTRING (12 12,18 17)
    1     Main Street  LINESTRING (2 2,3 2,4 1)
    >>> gdf = GeoDataFrame.from_table("sample_streets", False)
    >>> gdf
          street_name              street_shape
    skey
    1      Coast Blvd  LINESTRING (12 12,18 17)
    1     Main Street  LINESTRING (2 2,3 2,4 1)
    >>> gdf = GeoDataFrame.from_table("sample_streets", True, "skey")
    >>> gdf
          street_name              street_shape
    skey
    1      Coast Blvd  LINESTRING (12 12,18 17)
    1     Main Street  LINESTRING (2 2,3 2,4 1)
    >>>