Skip to content

FIX check_transformer_data_not_an_array for ColumnTransformer #29938

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions sklearn/compose/_column_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,6 @@ def __sklearn_tags__(self):
"check_estimators_nan_inf": "FIXME",
"check_estimator_sparse_array": "FIXME",
"check_estimator_sparse_matrix": "FIXME",
"check_transformer_data_not_an_array": "FIXME",
"check_fit1d": "FIXME",
"check_fit2d_predict1d": "FIXME",
"check_complex_data": "FIXME",
Expand All @@ -1338,7 +1337,11 @@ def __sklearn_tags__(self):

def _check_X(X):
"""Use check_array only when necessary, e.g. on lists and other non-array-likes."""
if hasattr(X, "__array__") or hasattr(X, "__dataframe__") or sparse.issparse(X):
if (
(hasattr(X, "__array__") and hasattr(X, "shape"))
or hasattr(X, "__dataframe__")
or sparse.issparse(X)
):
return X
return check_array(X, ensure_all_finite="allow-nan", dtype=object)

Expand Down