AttributeError: 'numpy.ndarray' object has no attribute 'values'

Machine Learning

Training_Set = Training_Set.values
sc = MinMaxScaler(feature_range=(0, 1))
Train = sc.fit_transform(Training_Set)

AttributeError Traceback (most recent call last)
<ipython-input-38-46db85ef43d1> in <module>
----> 1 Training_Set = Training_Set.values
2 sc = MinMaxScaler(feature_range=(0, 1))
3 Train = sc.fit_transform(Training_Set)

AttributeError: 'numpy.ndarray' object has no attribute 'values'

1
Answers

Replies

There is no need to add the values after performing the train_test_split as the output is an array. You can simply try with the below code:



Xtrain = Xtrain.reshape(-1,1)


Xtest = Xtest.reshape(-1,1)

 
 

If you want to unleash your potential in this competitive field, please visit the Machine Learning course page for more information, where you can find the Machine Learning tutorials and Machine Learning frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.
Protected by Astra Security