-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Exception when transforming LabelEncoder with keyword argument #26854
Copy link
Copy link
Closed
Labels
Description
Describe the bug
The transform method of LabelEncoder raises an exception when providing y with a keyword argument.
I mentioned this in discussion #26841 but I am more and more certain this is a bug. And even if it isn't and there is some good reason it fails, the error message is completely unclear since it refers to a parameter that is not present in the method.
Steps/Code to Reproduce
from sklearn.preprocessing import LabelEncoder
le = LabelEncoder().fit_transform(y=[0, 2, 2, 0])Expected Results
Normal output of the transform method. Same as when calling LabelEncoder().fit_transform([0, 1, 2]) (withoyt y=), which in the above example would be array([0, 1, 1, 0], dtype=int64).
Actual Results
Versions
System:
python: 3.10.9 (tags/v3.10.9:1dd9be6, Dec 6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
executable: C:\repos\dblib\venv\Scripts\python.exe
machine: Windows-10-10.0.22621-SP0
Python dependencies:
sklearn: 1.3.0
pip: 23.2
setuptools: 65.5.1
numpy: 1.25.1
scipy: 1.11.1
Cython: None
pandas: 1.4.4
matplotlib: None
joblib: 1.3.1
threadpoolctl: 3.2.0
Built with OpenMP: True
threadpoolctl info:
user_api: openmp
internal_api: openmp
num_threads: 8
prefix: vcomp
filepath: C:\repos\dblib\venv\Lib\site-packages\sklearn\.libs\vcomp140.dll
version: None
user_api: blas
internal_api: openblas
num_threads: 8
prefix: libopenblas
filepath: C:\repos\dblib\venv\Lib\site-packages\numpy\.libs\libopenblas64__v0.3.23-gcc_10_3_0.dll
version: 0.3.23
threading_layer: pthreads
architecture: SkylakeX
user_api: blas
internal_api: openblas
num_threads: 8
prefix: libopenblas
filepath: C:\repos\dblib\venv\Lib\site-packages\scipy.libs\libopenblas_v0.3.20-571-g3dec11c6-gcc_10_3_0-c2315440d6b6cef5037bad648efc8c59.dll
version: 0.3.21.dev
threading_layer: pthreads
architecture: SkylakeXReactions are currently unavailable
