ValueError:该条件应为布尔数组,而不是float64

时间:2020-09-01 16:01:25

标签: 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
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()

1 个答案:

答案 0 :(得分:0)

您可以调整其形状为目标变量和特征矩阵。

X = data.drop("diagnosis_result",1).reshape(-1,1)   #Feature Matrix
y = data["diagnosis_result"]..reshape(-1,1)          #Target Variable