Shortcuts

PandasDataset

class torchtime.datasets.PandasDataset(path: Optional[str] = None, dataframe: Optional[DataFrame] = None, dimensions: Optional[List[str]] = None, labels: Optional[str] = None, **kwargs)[source]

Base class for creating datasets which are compatible with torchtime from pandas.Dataframe.

Parameters:
  • path (str) – The path to the pickle file containing the pandas.Dataframe to load.

  • dataframe (pd.Dataframe) – The pandas.Dataframe to load.

  • dimensions (list, optional) – The columns of the pandas.Dataframe which contain the individual dimensions of contained time series. If None is given, all columns are considered to hold the timer series data.

  • labels (str, optional) – The column of the pandas.Dataframe which contains the labels. If None is given, the data is assumed to have no labels.

Note

path and dataframe are mutually exclusive.

__getitem__(index: Union[int, slice]) Tuple[Any, Any][source]
Parameters:

index (Union[int, slice]) – The index of the sample to return.

Returns:

If __has_labels is True, returns (series, target), where target is the index of the target class. Else, returns (series, torch.empty), where the empty tensor has the required shape.

Return type:

tuple