Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] test that forecasters preserve name attr of pd.Series #4157

Merged
merged 3 commits into from Feb 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions sktime/forecasting/tests/test_all_forecasters.py
Expand Up @@ -328,6 +328,21 @@ def test_predict_time_index_in_sample_full(
except NotImplementedError:
pass

def test_predict_series_name_preserved(self, estimator_instance):
"""Test that fit/predict preserves name attribute and type of pd.Series."""
# skip this test if estimator needs multivariate data
# because then it does not take pd.Series at all
if estimator_instance.get_tag("scitype:y") == "multivariate":
return None

y_train = _make_series(n_timepoints=15)
y_train.name = "foo"

estimator_instance.fit(y_train, fh=[1, 2, 3])
y_pred = estimator_instance.predict()

_assert_correct_columns(y_pred, y_train)

def _check_pred_ints(
self, pred_ints: pd.DataFrame, y_train: pd.Series, y_pred: pd.Series, fh_int
):
Expand Down