TDMatrix | Input Classes for UAF Functions | teradataml - TDMatrix - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for Python
Release Number
20.00
Published
March 2024
Language
English (United States)
Last Update
2024-04-09
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage

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, that is, the id argument, and is indexed by its 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.
Required Arguments:
  • data: Specifies the teradataml DataFrame.
  • id: Specifies the name of the column in data containing the identifier values.
  • row_index: Specifies the name of the column in data containing the row indexing values.
  • column_index: Specifies the name of the column in data containing the column indexing values.
Optional Arguments:
  • row_index_style: Specifies the style of row indexing.

    Permitted values are "TIMECODE" (default value), "SEQUENCE".

  • column_index_style: Specifies the style of column indexing.

    Permitted values are "TIMECODE" (default value), "SEQUENCE".

  • id_sequence: Specifies a sequence of series to plot.
  • payload_field: Specifies the names of the fields for payload.
  • payload_content: 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"
  • layer: Specifies the layer name of the ART table, if dataframe is created on ART table.

Example 1: 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