-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Open
Description
If I try to pass some input to KBinsDiscretizer
that would contain NaNs, it will throw an error instead of ignoring the NAs:
import numpy as np
from sklearn.preprocessing import KBinsDiscretizer
X = np.arange(10).reshape((-1,1))
X[2] = np.nan
kb = KBinsDiscretizer(encode="ordinal", strategy="quantile")
kb.fit(X)
ValueError: cannot convert float NaN to integer
The bins could still be calculated if one ignores the NAs and outputs them as np.nan
in the transformation.