我正在使用以下代码对数据集进行特征缩放(标准化):
for i in cnames:
print(i)
churn_train[i] = (churn_train[i] - min(churn_train[i]))/(max(churn_train[i]) - min(churn_train[i]))
但是,我得到了错误:
TypeError跟踪(最近的呼叫 最后)
in()
2 for i in cnames: 3 print(i)
----> 4 churn_train [i] =(churn_train [i]-min(churn_train [i]))/(max(churn_train [i])-min(churn_train [i]))
TypeError:“ numpy.float64”对象不可调用
答案 0 :(得分:0)
尝试下面的python代码
for i in cnames:
print(i)
churn_train[i] = (churn_train[i] - churn_train[i].min())/(churn_train[i].max()) - min(churn_train[i]))