Reputation: 827
Can anybody tell me how i can remove the below warning? I want to normalize a set of integer values by min-max normalization technique but i am getting this warning and don't know how to solve it? (X is a column of integer values starting from 0 to 127)
Here is the code:
X = df.iloc[:,0]
mms = MinMaxScaler()
a=X.reshape(-1, 1)
b=mms.fit_transform(a)
sns.set(color_codes=True)
np.random.seed(sum(map(ord, "distributions")))
ax=sns.distplot(b);
ax.set(xlabel='frequency', ylabel='Probability')
plt.show()
And here is the warning:
DataConversionWarning: Data with input dtype int64 was converted to float64 by MinMaxScaler. warnings.warn(msg, DataConversionWarning)
Upvotes: 3
Views: 2892
Reputation: 2239
MinMaxScaler()
works using float numbers, so it will automatically convert your np.array
of type np.int
to np.float
and inform you about it. If you don't want to see this warning, do the conversion explicitly beforehand:
b = mms.fit_transform(a.astype(np.float))
Upvotes: 2