Teradata Package for Python Function Reference | 20.00 - TDMatrix - 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.TDMatrix.__init__ = __init__(self, data, id, row_index, column_index, row_index_style='TIMECODE', column_index_style='TIMECODE', id_sequence=None, payload_field=None, payload_content=None, layer=None)
DESCRIPTION:
    Create a TDMatrix object from a teradataml DataFrame representing
    a MATRIX in time series
    which is used as input to Unbounded Array Framework,
    time series functions.
 
    A matrix is a two-dimensional array that has rows and columns.
    A matrix is identified by its matrix id, i.e., "id" argument,
    and is indexed by "row_index" and "column_index" arguments.
    A matrix can be a one of the following types:
        * Row-major matrix: Each row is a wavelet that is grouped by
          its matrix id and "row_index", and ordered by its "column_index".
        * Column-major matrix: Each column is a wavelet that is grouped
          by its matrix id and "column_index", and ordered by its "row_index".
 
PARAMETERS:
    data:
        Required Argument.
        Specifies the teradataml Dataframe.
        Types: teradataml DataFrame
 
    id:
        Required Argument.
        Specifies the name of the column in "data" containing the
        identifier values.
        Types: str or list of str
 
    row_index:
        Required Argument.
        Specifies the name of the column in "data" containing the
        row indexing values.
        Types: str
 
    column_index:
        Required Argument.
        Specifies the name of the column in "data" containing
        the column.
        indexing values.
        Types: str
 
    row_index_style:
        Optional Argument.
        Specifies the style of row indexing.
        Default Value: "TIMECODE"
        Permitted Values: "TIMECODE", "SEQUENCE"
        Types: str
 
    column_index_style:
        Optional Argument.
        Specifies the style of column indexing.
        Default Value: "TIMECODE"
        Permitted Values: "TIMECODE", "SEQUENCE"
        Types: str
 
    id_sequence:
        Optional Argument.
        Specifies a sequence of series to plot.
        Types: str or list of str
 
    payload_field:
        Optional Argument.
        Specifies the names of the fields for payload.
        Types: str or list of str
 
    payload_content:
        Optional Argument.
        Specifies the payload content type.
        Permitted Values: "REAL", "COMPLEX", "AMPL_PHASE",
                          "AMPL_PHASE_RADIANS", "AMPL_PHASE_DEGREES",
                          "MULTIVAR_REAL", "MULTIVAR_COMPLEX",
                          "MULTIVAR_ANYTYPE", "MULTIVAR_AMPL_PHASE",
                          "MULTIVAR_AMPL_PHASE_RADIANS ",
                          "MULTIVAR_AMPL_PHASE_DEGREES"
        Types: str
 
    layer:
        Optional Argument.
        Specifies the layer name of the ART table, if dataframe is created on ART table.
        Types: str
 
RAISES:
    None
 
RETURNS:
    None
 
EXAMPLES:
    # Create a TDMatrix object.
    >>> from teradataml import create_context, load_example_data, DataFrame, TDMatrix
    >>> con = create_context(host = host, user=user, password=passw)
    >>> load_example_data("dataframe", "admissions_train")
 
    # Create a DataFrame to be passed as input to TDMatrix.
    >>> data = DataFrame("admissions_train")
 
    # Create a TDMatrix object to be passed as input to UAF functions.
    >>> res = TDMatrix(data=data, id='admitted', row_index='id',
                       column_index = 'admitted', row_index_style="TIMECODE",
                       payload_field='payload_field',payload_content='REAL')
    >>> res
       masters   gpa     stats programming  admitted
    id
    15     yes  4.00  Advanced    Advanced         1
    34     yes  3.85  Advanced    Beginner         0
    13      no  4.00  Advanced      Novice         1
    38     yes  2.65  Advanced    Beginner         1
    5       no  3.44    Novice      Novice         0
    40     yes  3.95    Novice    Beginner         0
    7      yes  2.33    Novice      Novice         1
    22     yes  3.46    Novice    Beginner         0
    26     yes  3.57  Advanced    Advanced         1
    17      no  3.83  Advanced    Advanced         1