From 996fd03e7b69cb56218d54dd9e38b538e9fba61a Mon Sep 17 00:00:00 2001 From: christopherbunn Date: Fri, 18 Aug 2023 14:52:12 -0400 Subject: [PATCH] Updated error message and docstring --- evalml/pipelines/utils.py | 5 +++-- evalml/tests/pipeline_tests/test_pipeline_utils.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/evalml/pipelines/utils.py b/evalml/pipelines/utils.py index b8a5ccaa48..17bb3f4adf 100644 --- a/evalml/pipelines/utils.py +++ b/evalml/pipelines/utils.py @@ -1490,7 +1490,8 @@ def stack_X(X, series_id_name, time_index, starting_index=None, series_id_values starting_index (int): The starting index to use for the stacked DataFrame. If None, the starting index will match that of the input data. Defaults to None. series_id_values (set): The unique values of a series ID, used to generate the index. If None, values will - be generated from X column values. Defaults to None. + be generated from X column values. Required if X only has time index values and no exogenous values. + Defaults to None. Returns: pd.DataFrame: The restacked features. @@ -1507,7 +1508,7 @@ def stack_X(X, series_id_name, time_index, starting_index=None, series_id_values if len(series_ids) == 0: raise ValueError( - "X has no exogenous variables and `series_id_values` is None.", + "Series ID values needs to be passed in X column values or as a set with the `series_id_values` parameter.", ) time_index_col = X[time_index].repeat(len(series_ids)).reset_index(drop=True) diff --git a/evalml/tests/pipeline_tests/test_pipeline_utils.py b/evalml/tests/pipeline_tests/test_pipeline_utils.py index b5a2737dca..151f1d01e7 100644 --- a/evalml/tests/pipeline_tests/test_pipeline_utils.py +++ b/evalml/tests/pipeline_tests/test_pipeline_utils.py @@ -1493,7 +1493,7 @@ def test_stack_X( with pytest.raises( ValueError, - match="X has no exogenous variables and `series_id_values` is None.", + match="Series ID values needs to be passed in X column values or as a set with the `series_id_values` parameter.", ): stack_X(X, "series_id", "date", starting_index=starting_index)