0
votes

Does anybody know how can i solve this warning in the code below?

Here is the warning: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and will raise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample. warnings.warn(DEPRECATION_MSG_1D, DeprecationWarning)

Here is the code:

%matplotlib inline
import numpy as np
import pandas as pd
from scipy import stats, integrate
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler
import seaborn as sns

data = np.genfromtxt('name.csv', delimiter=",")
X = data[:,1]
mms = MinMaxScaler()
a=X.reshape(-1, 1)
a_norm = mms.fit_transform(X)
sns.set(color_codes=True)
np.random.seed(sum(map(ord, "distributions")))
sns.distplot(a_norm);

Even though, I am making changes according to the warning, I am getting the error which is mentioned above from this line "a_norm = mms.fit_transform(X)".

I really need help for this warning

1
You seem to call X.reshape, save the result into a variable called a which you then never reference for the rest of the script. I suspect you mean to pass a instead of X to which function is throwing that deprecation warning? - Shadow
@shadow I wanted to see distribution of data after normalization which is stored in "a_norm". So, I have a_norm for the parameter of sns.distplot(). In fact, mms. fit_transform is giving me the error. - Shelly
What about a_norm = mms.fit_transform(X)? Shouldn't that be a_norm = mms.fit_transform(a)? - Shadow

1 Answers

0
votes

replace a_norm = mms.fit_transform(X) with a_norm = mms.fit_transform(a)