TDSeries | Input Classes for UAF Functions | teradataml - TDSeries - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-02-17
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Create a TDSeries object from a teradataml DataFrame representing a SERIES in time series which is used as input to Unbounded Array Framework (UAF), time series functions.

A series is a one-dimensional array. They are the basic input of UAF functions. A series is identified by its series ID, that is, the id argument, and indexed by its row_index argument.

Series is passed to and returned from UAF functions as wavelets. Wavelets are collections of rows, grouped by one or more fields, and ordered on the row_axis argument.

Any operations like filter, select, sum, and so on, over TDSeries returns a teradataml DataFrame.

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.
Optional Arguments:
  • row_index_style: Specifies the style of row indexing.

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

  • in_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.
  • interval: Specifies the indicator to divide a series into a collection of intervals along its row-axis.
    interval is categorized in to 4 types:
    • Values represent time-duration.
      Allowed values include:
      • CAL_YEARS
      • CAL_MONTHS
      • CAL_DAYS
      • WEEKS
      • DAYS
      • HOURS
      • MINUTES
      • SECONDS
      • MILLISECONDS
      • MICROSECONDS
    • Values represent time-zero.
      Allowed values include:
      • DATE
      • TIMESTAMP
      • TIMESTAMP WITH TIME ZONE
    • Values represent an integer or floating number.

      Allowed values include a positive integer or float ranging from 1 to 32767, inclusively.

    • sequence-zero.

      This is an expression which evaluates to an INTEGER or FLOAT. Used when row_index_style is SEQUENCE.

    Permitted values for argument interval include individual values or combined values from the following:
    • time-duration
    • time-duration, time-zero
    • integer
    • float, integer
    • sequence-zero
    • float, sequence-zero

Example 1: Create TDSeries

>>> from teradataml import create_context, load_example_data, DataFrame, TDSeries
>>> con = create_context(host = host, user=user, password=passw)
>>> load_example_data("dataframe", "admissions_train")
# Create a DataFrame to be passed as input to TDSeries.
>>> data = DataFrame("admissions_train")
# Create TDSeries object which can be used as Series_Spec input in UAF functions.
>>> result = TDSeries(data=data, 
                      id="admitted", 
                      row_index="admitted",
                      payload_field="abc",
                      payload_content="REAL")
>>> result
       masters   gpa     stats programming  admitted
 id
 5       no  3.44    Novice      Novice         0
 34     yes  3.85  Advanced    Beginner         0
 13      no  4.00  Advanced      Novice         1
 40     yes  3.95    Novice    Beginner         0
 22     yes  3.46    Novice    Beginner         0
 19     yes  1.98  Advanced    Advanced         0
 36      no  3.00  Advanced      Novice         0
 15     yes  4.00  Advanced    Advanced         1
 7      yes  2.33    Novice      Novice         1
 17      no  3.83  Advanced    Advanced         1