Teradata Package for Python Function Reference | 20.00 - SeasonalNormalize - 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
Published
March 2024
Language
English (United States)
Last Update
2024-04-10
dita:id
TeradataPython_FxRef_Enterprise_2000
Product Category
Teradata Vantage
 
 
SeasonalNormalize

 
Functions
       
SeasonalNormalize(data=None, data_filter_expr=None, season_cycle=None, cycle_duration=None, season_info=0, output_fmt_index_style='NUMERICAL_SEQUENCE', **generic_arguments)
DESCRIPTION:
    The function SeasonalNormalize() takes a non-stationary series and
    normalizes the series by removing the unit roots. The function can
    be used with any cyclic data that can be subdivided into a collection
    of logical periods, in which each period can be further subdivided
    into a collection of logical intervals.
 
    The following procedure is an example of how to use SeasonalNormalize():
        1. Detect the unit roots using DickeyFuller().
        2. Use DIFF() or SeasonalNormalize() to eliminate unit roots.
        3. Use Unnormalize() to undo the effects of SeasonalNormalize(),
           and compare it to the original series.
 
 
PARAMETERS:
    data:
        Required Argument.
        Specifies a logical-runtime series, with real number
        elements.
        Types: TDSeries
 
    data_filter_expr:
        Optional Argument.
        Specifies the filter expression for "data".
        Types: ColumnExpression
 
    season_cycle:
        Required Argument.
        Specifies the logical time-unit.
        Permitted Values:
            * CAL_YEARS
            * CAL_MONTHS
            * CAL_DAYS
            * WEEKS
            * DAYS
            * HOURS
            * MINUTES
            * SECONDS
            * MILLISECONDS
            * MICROSECONDS
        Types: str
 
    cycle_duration:
        Required Argument.
        Specifies the number of time-units as the duration of each seasonal
        cycle.
        Types: int
 
    season_info:
        Optional Argument.
        Specifies whether to generate additional columns CYCLE_NO and
        SEASON_NO. CYCLE_NO is the n-th cycle of the season. SEASON_NO
        is the season for the data.
        Permitted Values:
            * 0 indicates no extra columns being generated.
            * 1 indicates SEASON_NO column being generated.
            * 2 indicates CYCLE_NO column being generated.
            * 3 indicates both SEASON_NO and CYCLE_NO columns being generated.
        Default Value: 0
        Types: int
 
    output_fmt_index_style:
        Optional Argument.
        Specifies the index style of the output format.
        Default Value: NUMERICAL_SEQUENCE
        Permitted Values:
            * NUMERICAL_SEQUENCE
            * FLOW_THROUGH
        Types: str
 
    **generic_arguments:
        Specifies the generic keyword arguments of UAF functions.
        Below are the generic keyword arguments:
            persist:
                Optional Argument.
                Specifies whether to persist the results of the
                function in a table or not. When set to True,
                results are persisted in a table; otherwise,
                results are garbage collected at the end of the
                session.
                Note that, when UAF function is executed, an 
                analytic result table (ART) is created.
                Default Value: False
                Types: bool
 
            volatile:
                Optional Argument.
                Specifies whether to put the results of the
                function in a volatile ART or not. When set to
                True, results are stored in a volatile ART,
                otherwise not.
                Default Value: False
                Types: bool
 
            output_table_name:
                Optional Argument.
                Specifies the name of the table to store results. 
                If not specified, a unique table name is internally 
                generated.
                Types: str
 
            output_db_name:
                Optional Argument.
                Specifies the name of the database to create output 
                table into. If not specified, table is created into 
                database specified by the user at the time of context 
                creation or configuration parameter. Argument is ignored,
                if "output_table_name" is not specified.
                Types: str
 
 
RETURNS:
    Instance of SeasonalNormalize.
    Output teradataml DataFrames can be accessed using attribute 
    references, such as SeasonalNormalize_obj.<attribute_name>.
    Output teradataml DataFrame attribute names are:
        1. result
        2. metadata
 
 
RAISES:
    TeradataMlException, TypeError, ValueError
 
 
EXAMPLES:
    # Notes:
    #     1. Get the connection to Vantage to execute the function.
    #     2. One must import the required functions mentioned in
    #        the example from teradataml.
    #     3. Function will raise error if not supported on the Vantage
    #        user is connected to.
 
    # Check the list of available UAF analytic functions.
    display_analytic_functions(type="UAF")
 
    # Load the example data.
    load_example_data("uaf", ["river_data"])
 
    # Create teradataml DataFrame object.
    data = DataFrame.from_table("river_data")
 
    # Create teradataml TDSeries object.
    data_series_df = TDSeries(data=data,
                              id="station_id",
                              row_index="timevalue",
                              row_index_style="TIMECODE",
                              payload_field="flow_velocity",
                              payload_content="REAL",
                              interval="CAL_MONTHS(1)")
 
    # Example 1 : Normalize the series by removing the unit roots.
    uaf_out = SeasonalNormalize(data=data_series_df,
                                season_cycle="CAL_MONTHS",
                                cycle_duration=1)
 
    # Print the result DataFrames.
    print(uaf_out.result)
    print(uaf_out.metadata)