Skip to content

Commit

Permalink
feat: raise value error for shape mismatch (#730)
Browse files Browse the repository at this point in the history
  • Loading branch information
FBruzzesi authored Jan 17, 2025
1 parent 9b15cef commit 9c53551
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sklego/meta/_grouped_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def parse_X_y(X, y, groups, check_X=True, **kwargs) -> nw.DataFrame:
name="tmp", values=[None] * n_samples if y is None else y, native_namespace=nw.get_native_namespace(X)
)

if len(y_series) != n_samples:
msg = f"Found input variables with inconsistent numbers of samples: {[n_samples, len(y_series)]}"
raise ValueError(msg)

return X.with_columns(__sklego_target__=y_series)


Expand Down

0 comments on commit 9c53551

Please sign in to comment.