When performing StandardScalar or MinMaxScalar using PythonAdv kernel the jupyter notebook is printing error. However, when using Python 3 environment the same jupyter note book is working fine:
from sklearn.preprocessing import MinMaxScaler
# Scale X values
X_scalar = MinMaxScaler().fit(X_train)
#print(X_scalar)
X_train_scaled = X_scaler.transform(X_train)
X_test_scaled = X_scaler.transform(X_test)
Error:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-5-e5dc00a586d3> in <module>
4 X_scalar = MinMaxScaler().fit(X_train)
5 #print(X_scalar)
----> 6 X_train_scaled = X_scaler.transform(X_train)
7 X_test_scaled = X_scaler.transform(X_test)
NameError: name 'X_scaler' is not defined
I have Anaconda 3, python 3.6 and PythonAdv environments on Git Bash on Windows.
question from:
https://stackoverflow.com/questions/65915769/jupyter-notebook-is-giving-error-when-using-minmaxscalar-or-standardscalar 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…