Python ValueError:条件应为布尔数组,而不是浮点64
我试图设定目标,然后缩放我的特征。但是,我得到一个错误:Python ValueError:条件应为布尔数组,而不是浮点64,python,scikit-learn,Python,Scikit Learn,我试图设定目标,然后缩放我的特征。但是,我得到一个错误: # Set a variable (features) with the names of all the features BUT the target variable. X = data.drop("diagnosis_result",1) #Feature Matrix y = data["diagnosis_result"] #Target Variable dat
# Set a variable (features) with the names of all the features BUT the target variable.
X = data.drop("diagnosis_result",1) #Feature Matrix
y = data["diagnosis_result"] #Target Variable
data.head()
print(f"The list of columns that represent features is:\n{X}")
print(f"So, we have {len(X)} dimensions in our feature vectors.")
scaler = RobustScaler().fit(data[X])
data[X] = scaler.transform(data[X]).round(2)
print()
data.head()
您可以将其重塑为目标变量和featurematrix
X = data.drop("diagnosis_result",1).reshape(-1,1) #Feature Matrix
y = data["diagnosis_result"]..reshape(-1,1) #Target Variable