TimeSeries#
- class pytorch_forecasting.data.timeseries._timeseries_v2.TimeSeries(data: DataFrame, data_future: DataFrame | None = None, time: str | None = None, target: str | list[str] | None = None, group: list[str] | None = None, weight: str | None = None, num: list[str | list[str]] | None = None, cat: list[str | list[str]] | None = None, known: list[str | list[str]] | None = None, unknown: list[str | list[str]] | None = None, static: list[str | list[str]] | None = None)[source]#
Bases:
DatasetPyTorch Dataset for time series data stored in pandas DataFrame.
- Parameters:
data (pd.DataFrame) – data frame with sequence data. Column names must all be str, and contain str as referred to below.
data_future (pd.DataFrame, optional, default=None) – data frame with future data. Column names must all be str, and contain str as referred to below. May contain only columns that are in time, group, weight, known, or static.
time (str, optional, default = first col not in group_ids, weight, target, static.) – integer typed column denoting the time index within
data. This column is used to determine the sequence of samples. If there are no missing observations, the time index should increase by+1for each subsequent sample. The first time_idx for each series does not necessarily have to be0but any value is allowed.target (str or List[str], optional, default = last column (at iloc -1)) – column(s) in
datadenoting the forecasting target. Can be categorical or numerical dtype.group (List[str], optional, default = None) – list of column names identifying a time series instance within
data. This means that thegrouptogether uniquely identify an instance, andgrouptogether withtimeuniquely identify a single observation within a time series instance. IfNone, the dataset is assumed to be a single time series.weight (str, optional, default=None) – column name for weights. If
None, it is assumed that there is no weight column.num (list of str, optional, default = all columns with dtype in "fi") – list of numerical variables in
data, list may also contain list of str, which are then grouped together.cat (list of str, optional, default = all columns with dtype in "Obc") – list of categorical variables in
data, list may also contain list of str, which are then grouped together (e.g. useful for product categories).known (list of str, optional, default = all variables) – list of variables that change over time and are known in the future, list may also contain list of str, which are then grouped together (e.g. useful for special days or promotion categories).
unknown (list of str, optional, default = no variables) – list of variables that are not known in the future, list may also contain list of str, which are then grouped together (e.g. useful for weather categories).
static (list of str, optional, default = all variables not in known, unknown) – list of variables that do not change over time, list may also contain list of str, which are then grouped together.
- Inherited-members:
Methods
Return metadata about the dataset.