Teradata Package for Python Function Reference | 20.00 - 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 - 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.dataframe.dataframe.DataFrame.from_table = from_table(table_name, index=True, index_label=None) method of builtins.type instance
- Class method for creating a DataFrame from a table or a view.
PARAMETERS:
table_name:
Required Argument.
The table 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
Column/s used for sorting.
Types: str
EXAMPLES:
from teradataml.dataframe.dataframe import DataFrame
# Example 1: The following example creates a DataFrame from a table or
a view.
# Load the example data.
load_example_data("dataframe","sales")
# Create DataFrame from table
df = DataFrame.from_table('sales')
# Create DataFrame from table and without index column sorting.
df = DataFrame.from_table("sales", False)
# Create DataFrame from table and sorting using the 'accounts'
# column.
df = DataFrame.from_table("sales", True, "accounts")
# Example 2: The following example creates a DataFrame from existing Vantage
# table "dbcinfo" in the non-default database "dbc" using the
# in_schema() function.
from teradataml.dataframe.dataframe import in_schema
df = DataFrame.from_table(in_schema("dbc", "dbcinfo"))
RETURNS:
DataFrame
RAISES:
TeradataMlException - TDMLDF_CREATE_FAIL