Replies: 1 comment 1 reply
-
In [3]: from sklearn.preprocessing import LabelEncoder
...: LabelEncoder().fit_transform(y=[0, 1 ,2])
Out[3]: array([0, 1, 2]) Works for me. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I get the following error when running this piece of code:
Output:
TypeError: LabelEncoder.transform() missing 1 required positional argument: 'X'
Why am I getting this error when there is no
X
parameter? And why does it not happen when I runle = LabelEncoder().fit_transform([0,1 ,2 ])
(withouty=
)?Looking at the source code I can't see why using a keyword argument would make it fail.
scikit-learn/sklearn/preprocessing/_label.py
Lines 118 to 135 in 7f9bad9
Beta Was this translation helpful? Give feedback.
All reactions