TimeSeriesDataFrame.from_iterable_dataset#

classmethod TimeSeriesDataFrame.from_iterable_dataset(iterable_dataset: Iterable, num_cpus: int = -1) DataFrame[source]#

Construct a TimeSeriesDataFrame from an Iterable of dictionaries each of which represent a single time series.

This function also offers compatibility with GluonTS data sets, see https://ts.gluon.ai/_modules/gluonts/dataset/common.html#ListDataset.

Parameters
  • iterable_dataset (Iterable) –

    An iterator over dictionaries, each with a target field specifying the value of the (univariate) time series, and a start field that features a pandas Timestamp with features. Example:

    iterable_dataset = [
        {"target": [0, 1, 2], "start": pd.Timestamp("01-01-2019", freq='D')},
        {"target": [3, 4, 5], "start": pd.Timestamp("01-01-2019", freq='D')},
        {"target": [6, 7, 8], "start": pd.Timestamp("01-01-2019", freq='D')}
    ]
    

  • num_cpus (int, default = -1) – Number of CPU cores used to process the iterable dataset in parallel. Set to -1 to use all cores.

Returns

ts_df – A data frame in TimeSeriesDataFrame format.

Return type

TimeSeriesDataFrame