split_by_date#

openstef_models.utils.data_split.split_by_date(dataset: T, split_date: datetime | Timestamp) tuple[T, T][source]#

Split a dataset into train and test sets based on a specific date.

Parameters:
  • dataset (TypeVar(T, bound= TimeSeriesDataset)) – The dataset to split.

  • split_date (datetime | Timestamp) – The date to split on. Data before this date goes to train, data at/after goes to test.

  • dataset

  • split_date

Returns:

Tuple of (train_dataset, test_dataset).

Return type:

tuple[TypeVar(T, bound= TimeSeriesDataset), TypeVar(T, bound= TimeSeriesDataset)]