TypeError:“ numpy.float64”对象在规范化期间不可调用

时间:2019-02-06 13:34:23

标签: min

我正在使用以下代码对数据集进行特征缩放(标准化):

规范化

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”对象不可调用

1 个答案:

答案 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]))