Issue
I use sklearn to transform data with this code.
sc = MinMaxScaler()
test= df['outcome']
y = sc.fit_transform(test)
It show error like this.
ValueError: Expected 2D array, got 1D array instead:
array=[ 21000. 36000. 5000. ... 7000. 12000. 11000.].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
How to fix it?
Solution
If I remember correctly, MinMaxScalar
can accept a pandas dataframe
but not a series
, so just do test = df[['outcome']]
(dataframe with one column) instead of test = df['outcome']
(a series).
Answered By - Aryerez
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.