Skip to content

Commit

Permalink
Updated error message and docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherbunn committed Aug 21, 2023
1 parent 4a32c11 commit 996fd03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions evalml/pipelines/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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(

Check warning on line 1510 in evalml/pipelines/utils.py

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/utils.py#L1509-L1510

Added lines #L1509 - L1510 were not covered by tests
"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)
Expand Down
2 changes: 1 addition & 1 deletion evalml/tests/pipeline_tests/test_pipeline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ def test_stack_X(

with pytest.raises(

Check warning on line 1494 in evalml/tests/pipeline_tests/test_pipeline_utils.py

View check run for this annotation

Codecov / codecov/patch

evalml/tests/pipeline_tests/test_pipeline_utils.py#L1494

Added line #L1494 was not covered by tests
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)

Check warning on line 1498 in evalml/tests/pipeline_tests/test_pipeline_utils.py

View check run for this annotation

Codecov / codecov/patch

evalml/tests/pipeline_tests/test_pipeline_utils.py#L1498

Added line #L1498 was not covered by tests

Expand Down

0 comments on commit 996fd03

Please sign in to comment.