I get the error when trying to run the following code:
df = pd.DataFrame(pd.read_csv('x_y.csv'))
pd.set_option('display.max_columns', None)
df = df.reset_index()
X = df['EU_Sales']
X.fillna(X.mean())
X = X.to_numpy().reshape(-1, 1)
np.nan_to_num(X)
df = df.reset_index()
est = KBinsDiscretizer(n_bins=2, encode='ordinal', strategy='quantile')
Xt = est.fit_transform(X)
I am trying to read from a column in my training set, I then turn it into an array with the reshape function, I printed the array to make sure this function works and it does. But for some reason when trying to use the KBinsDiscretizer function, I get an error code saying I have a null or infinity value in my array.
What is the problem?