Skip to content

Commit

Permalink
[MNT] address pd.Series constructor dtype deprecation (sktime#4031)
Browse files Browse the repository at this point in the history
This PR addresses the deprecation message received from `pandas` for one instance of `pd.Series` constructor with `dtype` not explicitly set.

The fix is setting the `dtype` explicitly, which resolves the deprecation message in case the resulting series is empty.
  • Loading branch information
fkiraly authored and klam-data committed Jan 18, 2023
1 parent 6e5751b commit ce86ed8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sktime/forecasting/model_selection/_split.py
Expand Up @@ -1272,7 +1272,8 @@ def _split(self, y: pd.Index) -> SPLIT_GENERATOR_TYPE:
train_end = _get_end(y_index=y, fh=fh)

training_window = get_window(
pd.Series(index=y[y <= y[train_end]]), window_length=window_length
pd.Series(index=y[y <= y[train_end]], dtype=y.dtype),
window_length=window_length,
).index
training_window = y.get_indexer(training_window)
if array_is_int(fh):
Expand Down

0 comments on commit ce86ed8

Please sign in to comment.