diff --git a/mlpp_lib/model_selection.py b/mlpp_lib/model_selection.py index 9d2020b..06d1c56 100644 --- a/mlpp_lib/model_selection.py +++ b/mlpp_lib/model_selection.py @@ -213,7 +213,10 @@ def _time_partitioning(self) -> None: for partition in self.partition_names: idx = self._time_indexers[partition] idx = pd.to_datetime(idx) # always convert to pandas datetime indices - idx = slice(*idx) if len(idx) == 2 else idx + if len(idx) == 2: + # convert slice to list of labels + time_index = pd.to_datetime(self.time_index) + idx = time_index[time_index.slice_indexer(start=idx[0], end=idx[1])] indexer = {self.time_dim_name: idx} if not hasattr(self, "partitions"): self.partitions = {p: {} for p in self.partition_names}