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

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.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)
    >>>