dlpy.timeseries.TimeseriesTable.timeseries_accumlation¶
-
TimeseriesTable.
timeseries_accumlation
(acc_interval='day', timeid=None, timeseries=None, groupby=None, extra_num_columns=None, default_ts_acc='sum', default_col_acc='avg', acc_method_byvar=None, user_defined_interval=None)¶ Accumulate the TimeseriesTable into regular consecutive intervals
Parameters: - acc_interval : string, optional
The accumulation interval, such as ‘year’, ‘qtr’, ‘month’, ‘week’, ‘day’, ‘hour’, ‘minute’, ‘second’.
- timeid : string, optional
Specifies the column name for the timeid. If None, it will take the timeid specified in timeseries_formatting.
Default: None- timeseries : string or list-of-strings, optional
Specifies the column name for the timeseries, that will be part of the input or output of the RNN. If str, then it is univariate time series. If list of strings, then it is multivariate timeseries. If None, it will take the timeseries specified in timeseries_formatting.
Default: None- groupby : string or list-of-strings, optional
The groupby variables.
Default: None- extra_num_columns : string or list-of-strings, optional
Specifies the addtional numeric columns to be included for accumulation. These columns can include static feature, and might be accumulated differently than the timeseries that will be used in RNN. if None, it means no additional numeric columns will be accumulated for later processing and modeling.
Default: None- default_ts_acc : string, optional
Default accumulation method for timeseries.
Default: sum- default_col_acc : string, optional
Default accumulation method for additional numeric columns
Default: avg- acc_method_byvar : dict, optional
It specifies specific accumulation method for individual columns, if the method is different from the default. It has following structure: {‘column1 name’: ‘accumulation method1’, ‘column2 name’: ‘accumulation method2’, …}
Default: None- user_defined_interval: string, optional
Use the user-defined interval to overwrite acc_interval See more details here: https://go.documentation.sas.com/?docsetId=casforecast&docsetTarget=casforecast_tsmodel_syntax04.htm&docsetVersion=8.4
Examples
>>> from swat import CAS >>> from dlpy.timeseries import TimeseriesTable >>> s=CAS("cloud.example.com", 5570) >>> time_tbl = TimeseriesTable.from_localfile(s, "path/to/file.csv", casout=dict(name='time_tbl', replace=True)) >>> time_tbl.timeseries_formatting(timeid='datetime', ... timeseries='series', ... timeid_informat='ANYDTDTM19.', ... timeid_format='DATETIME19.') >>> time_tbl.timeseries_accumlation(acc_interval='day', ... timeseries = 'series', ... groupby=['id1var', 'id2var'])