Teradata Package for Python Function Reference on VantageCloud Lake - from_dict - 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
20.00.00.11
Publication Date
August 2026
Content Type
Programming Reference
Publication ID
B700-4500-200K
ft:locale
en-US
ft:lastEdition
2026-08-13
ft:sourceId
FTML
dita:id
TeradataPython_FxRef_Lake_2000
Product Category
Teradata Vantage
teradataml.dataframe.dataframe.DataFrame.from_dict = from_dict(data, columns=None, persist=False) method of builtins.type instance
DESCRIPTION:
    Creates a DataFrame from a dictionary containing values as lists or numpy arrays.
 
PARAMETERS:
    data:
        Required Argument.
        Specifies the Python dictionary to create a teradataml DataFrame.
        Notes:
            * Keys of the dictionary are used as column names.
            * Values of the dictionary should be lists or numpy arrays.
            * Nested dictionaries are not supported.
        Types: dict
 
    columns:
        Optional Argument.
        Specifies the column names for the DataFrame.
        Types: str OR list of str
 
    persist:
        Optional Argument.
        Specifies whether to persist the DataFrame.
        Default Value: False
        Types: bool
 
RETURNS:
    teradataml DataFrame
 
RAISES:
    TeradataMlException
 
EXAMPLES:
    >>> from teradataml import DataFrame
    >>> data_dict = {"name": ["Alice", "Bob", "Charlie"], "age": [25, 30, 28]}
 
    # Example 1: Create a teradataml DataFrame from a dictionary where
    #            keys are column names and values are lists of column data.
    >>> df = DataFrame.from_dict(data_dict)
    >>> df
          name  age
    0  Charlie   28
    1      Bob   30
    2    Alice   25
 
    # Example 2: Create a teradataml DataFrame from a dictionary where
    #            keys are column names and values are numpy arrays.
    >>> import numpy as np
    >>> data_dict = {"col1": np.array([1, 2, 3]), "col2": np.array([4, 5, 6])}
    >>> df = DataFrame.from_dict(data_dict)
    >>> df
       col1  col2
    0     3     6
    1     2     5
    2     1     4
 
    # Example 3: Persist the data from dictionary into a table which can be used across sessions.
    >>> df = DataFrame.from_dict(data_dict, persist=True)
    >>> df
          name  age
    0  Charlie   28
    1      Bob   30
    2    Alice   25
 
    # Get/view the database object name.
    >>> df.db_object_name
    '"ml__from_pandas_1761725700090504"'
 
    # Create the teradataml DataFrame using the database object name in different session.
    >>> DataFrame('"ml__from_pandas_1761725700090504"')
          name  age
    0  Charlie   28
    1      Bob   30
    2    Alice   25