TDAnalyticResult | Input Classes for UAF Functions | teradataml - TDAnalyticResult - 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-10-10
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
lifecycle
latest
Product Category
Teradata Vantage

Create a TDAnalyticResult object from a teradataml Dataframe created on an Analytic Result Table (ART) which can be used as input to Unbounded Array Framework functions.

The primary use of an analytical result table (ART) is to associate function results with a name label, enabling users to easily retrieve the result data and pass the result to another UAF function.

An ART can have multiple layers. Each layer has its own dedicated row composition for the series or matrix.

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

Required Arguments:
  • data: Specifies the teradataml DataFrame.
Optional Arguments
  • 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: Prepare input for UAF function using an Analytic Result Table (ART)

>>> from teradataml import create_context
>>> con = create_context(host=host, user= user, password=password)
# Create a Analytic Result Table(ART) by executing SInfo function.
>>> from teradataml import load_example_data, SInfo
>>> load_example_data("uaf", ["ocean_buoys2"])
# Create teradataml DataFrame object.
>>> data = DataFrame.from_table("ocean_buoys2")
# Create teradataml TDSeries object.
>>> data_series_df = TDSeries(data=data,
                              id=["ocean_name","buoyid"],
                              row_index="TD_TIMECODE",
                              row_index_style="TIMECODE",
                              payload_field="jsoncol.Measure.salinity",
                              payload_content="REAL")
# Execute SInfo function and store the output in 'TSINFO_RESULTS'.
>>> uaf_out = SInfo(data=data_series_df, output_table_name='TSINFO_RESULTS')
# Create a teradataml dataframe on 'TSINFO_RESULTS' ART.
>>> art_df = DataFrame('TSINFO_RESULTS')
# Check if the DataFrame 'art_table' is created on an ART.
>>> art_df.is_art
    True
# Create TDAnalyticResult object which can be used as input in UAF functions.
>>> result = TDAnalyticResult(data=art_df)
# Check if 'result' is created on an ART.
>>> result.is_art
 True
>>> result
               buoyid  ROW_I      INDEX_DT                 INDEX_BEGIN                   INDEX_END  NUM_ENTRIES  DISCRETE          SAMPLE_INTERVAL CONTENT  MIN_MAG_salinity  MAX_MAG_salinity  AVG_MAG_salinity  RMS_MAG_salinity HAS_NULL_NAN_INF
            0      44      1  TIMESTAMP(6)  2014-01-06 10:00:24.000000  2014-01-06 10:52:00.000009           13         0  MICROSECONDS(258000001)    REAL              55.0              55.0              55.0              55.0                N    
            1       0      1  TIMESTAMP(6)  2014-01-06 08:00:00.000000  2014-01-06 08:10:00.000000            5         0             SECONDS(150)    REAL              55.0              55.0              55.0              55.0                N
            2       2      1  TIMESTAMP(6)  2014-01-06 21:01:25.122200  2014-01-06 21:03:25.122200            3         1               MINUTES(1)    REAL              55.0              55.0              55.0              55.0                N
            3       1      1  TIMESTAMP(6)  2014-01-06 09:01:25.122200  2014-01-06 09:03:25.122200            6         0              SECONDS(24)    REAL              55.0              55.0              55.0              55.0                N