Teradata Python Package Function Reference - CumulativeMovAvg - Teradata Python Package - Look here for syntax, methods and examples for the functions included in the Teradata Python Package.

Teradata® Python Package Function Reference

Product
Teradata Python Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-07-17
lifecycle
previous
Product Category
Teradata Vantage

 
teradataml.analytics.mle.CumulativeMovAvg = class CumulativeMovAvg(builtins.object)
     Methods defined here:
__init__(self, data=None, target_columns=None, data_sequence_column=None, data_partition_column=None, data_order_column=None)
DESCRIPTION:
    The CumulativeMovAvg function computes the cumulative moving average of a value
    from the beginning of a series.
 
 
PARAMETERS:
    data:
        Required Argument.
        Specifies the name of the teradataml DataFrame that contains the
        columns.
 
    data_partition_column:
        Required Argument.
        Specifies Partition By columns for data.
        Values to this argument can be provided as list, if multiple columns
        are used for partition.
        Types: str OR list of Strings (str)
 
    data_order_column:
        Required Argument.
        Specifies Order By columns for data.
        Values to this argument can be provided as list, if multiple columns
        are used for ordering.
        Types: str OR list of Strings (str)
 
    target_columns:
        Optional Argument.
        Specifies the input column names for which the moving average is to
        be computed. If you omit this argument, then the function copies
        every input column to the output teradataml DataFrame but does not
        compute moving average.
        Types: str OR list of Strings (str)
 
    data_sequence_column:
        Optional Argument.
        Specifies the list of column(s) that uniquely identifies each row of
        the input argument "data". The argument is used to ensure
        deterministic results for functions which produce results that vary
        from run to run.
        Types: str OR list of Strings (str)
 
RETURNS:
    Instance of CumulativeMovAvg.
    Output teradataml DataFrames can be accessed using attribute
    references, such as CumulativeMovAvgObj.<attribute_name>.
    Output teradataml DataFrame attribute name is:
        result
 
 
RAISES:
    TeradataMlException
 
 
EXAMPLES:
    # Load Example Data
    load_example_data("movavg", "ibm_stock")
 
    # Create teradataml DataFrame objects.
    ibm_stock = DataFrame.from_table("ibm_stock")
 
    # Compute the cumulative moving average for "stockprice".
    CumulativeMovAvg_out = CumulativeMovAvg(data = ibm_stock,
                                            data_partition_column = ["name"],
                                            data_order_column = ["period"],
                                            target_columns = ["stockprice"]
                                            )
    # Print the results
    print(CumulativeMovAvg_out)
__repr__(self)
Returns the string representation for a CumulativeMovAvg class instance.