ColumnTransformer breaks where X is a list
See original GitHub issue>>> from sklearn.preprocessing import StandardScaler
>>> from sklearn.compose import ColumnTransformer
>>> ColumnTransformer([('foobar', StandardScaler(), [0, 1, 2])]).fit([[1, 2, 3]])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/joel/repos/scikit-learn/sklearn/compose/_column_transformer.py", line 398, in fit
self.fit_transform(X, y=y)
File "/Users/joel/repos/scikit-learn/sklearn/compose/_column_transformer.py", line 422, in fit_transform
self._validate_remainder(X)
File "/Users/joel/repos/scikit-learn/sklearn/compose/_column_transformer.py", line 275, in _validate_remainder
n_columns = X.shape[1]
AttributeError: 'list' object has no attribute 'shape'
The passed list should be interpreted as an array for the sake of extracting columns. Instead an error is raised.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
AttributeError when using ColumnTransformer into a pipeline
ColumnTransformer returns numpy.array , so it can't have column attribute ... it would break the pipeline (someone correct me if I'm wrong).
Read more >Lecture 6: sklearn ColumnTransformer and Text Features
pass a list of lists to OrdinalEncoder , where each inner list corresponds to manually created list of ordered categories for a corresponding...
Read more >sklearn.compose.ColumnTransformer
Parameters: transformerslist of tuples. List of (name, transformer, columns) tuples specifying the transformer objects to be applied to subsets of the data.
Read more >Column Transformer With Heterogeneous Data Sources ...
We combine them (with weights) using a ColumnTransformer and finally train a ... x, y=None): return self def transform(self, posts): return [{'length': ...
Read more >'columntransformer' object has no attribute '_feature_names_in'
scikit-learn/scikit-learnColumnTransformer breaks where X is a list#12096. Created about 4 years ago. 5. py >>> from sklearn.preprocessing import ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Not supporting lists is very unconventional behaviour for scikit-learn…
@aditya1994 there is an open PR: https://github.com/scikit-learn/scikit-learn/pull/12104