Teradata Package for Python Function Reference on VantageCloud Lake | 17.20 - __init__ - 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.dataframe.dataframe.DataFrame.__init__ = __init__(self, table_name=None, index=True, index_label=None, query=None, materialize=False)
Constructor for teradataml DataFrame.
 
PARAMETERS:
    table_name:
        Optional Argument.
        The table name or view name in Teradata Vantage referenced by this DataFrame.
        Types: str
 
    index:
        Optional Argument.
        True if using index column for sorting, otherwise False.
        Default Value: True
        Types: bool
 
    index_label:
        Optional Argument.
        Column/s used for sorting.
        Types: str OR list of Strings (str)
 
    query:
        Optional Argument.
        SQL query for this Dataframe. Used by class method from_query.
        Types: str
 
    materialize:
        Optional Argument.
        Whether to materialize DataFrame or not when created.
        Used by class method from_query.
 
        You should use materialization, when the query  passed to from_query(),
        is expected to produce non-deterministic results, when it is executed multiple
        times. Using this option will help user to have deterministic results in the
        resulting teradataml DataFrame.
        Default Value: False (No materialization)
        Types: bool
 
EXAMPLES:
    from teradataml.dataframe.dataframe import DataFrame
 
    # Example 1: The following example creates a DataFrame from the 'table_name'
    #            or 'view_name'.
    # Created DataFrame using table name.
    df = DataFrame("mytab")
 
    # Created DataFrame using view name.
    df = DataFrame("myview")
 
    # Created DataFrame using view name without using index column for sorting.
    df = DataFrame("myview", False)
 
    # Created DataFrame using table name and sorted using Col1 and Col2
    df = DataFrame("mytab", True, "Col1, Col2")
 
 
    # Example 2: The following example creates a DataFrame from the existing Vantage
    #            table "dbcinfo" in the non-default database "dbc" using the
    #            in_schema() function.
    from teradataml.dataframe.dataframe import in_schema
    df = DataFrame(in_schema("dbc", "dbcinfo"))
 
RAISES:
    TeradataMlException - TDMLDF_CREATE_FAIL