Skip to content

Commit

Permalink
Final nits
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherbunn committed Aug 21, 2023
1 parent 996fd03 commit 3e28e27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions evalml/pipelines/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ def stack_X(X, series_id_name, time_index, starting_index=None, series_id_values
time_index (str): The name of the time index column.
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
series_id_values (set, list): The unique values of a series ID, used to generate the index. If None, values will
be generated from X column values. Required if X only has time index values and no exogenous values.
Defaults to None.
Expand All @@ -1508,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
"Series ID values needs to be passed in X column values or as a set with the `series_id_values` parameter.",
"Series ID values need 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
6 changes: 4 additions & 2 deletions evalml/tests/pipeline_tests/test_pipeline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1472,11 +1472,13 @@ def test_stack_data_noop():
pd.testing.assert_series_equal(stack_data(series_y), series_y)


@pytest.mark.parametrize("series_id_values_type", [set, list])
@pytest.mark.parametrize("no_features", [True, False])

Check warning on line 1476 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#L1475-L1476

Added lines #L1475 - L1476 were not covered by tests
@pytest.mark.parametrize("starting_index", [None, 1, 132])
def test_stack_X(
starting_index,
no_features,
series_id_values_type,
multiseries_ts_data_stacked,
multiseries_ts_data_unstacked,
):
Expand All @@ -1487,13 +1489,13 @@ def test_stack_X(
X_expected.index = X_expected.index + starting_index

if no_features:
series_id_values = set(str(i) for i in range(0, 5))
series_id_values = series_id_values_type(str(i) for i in range(0, 5))
X = pd.DataFrame(X["date"])
X_expected = X_expected[["date", "series_id"]]

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#L1491-L1494

Added lines #L1491 - L1494 were not covered by tests

with pytest.raises(

Check warning on line 1496 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#L1496

Added line #L1496 was not covered by tests
ValueError,
match="Series ID values needs to be passed in X column values or as a set with the `series_id_values` parameter.",
match="Series ID values need 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 1500 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#L1500

Added line #L1500 was not covered by tests

Expand Down

0 comments on commit 3e28e27

Please sign in to comment.