首页 > 其他 > 详细

'Int64Index' object has no attribute 'reshape'

时间:2020-02-11 11:04:19      阅读:307      评论:0      收藏:0      [点我收藏+]

python机器学习基础教程,P187

书中:

X= citibike.index.strftime("%s").astype("int").reshape(-1,1)

报错:

Int64Index([1438358400, 1438369200, 1438380000, 1438390800, 1438401600,
            1438412400, 1438423200, 1438434000, 1438444800, 1438455600,
            ...
            1440928800, 1440939600, 1440950400, 1440961200, 1440972000,
            1440982800, 1440993600, 1441004400, 1441015200, 1441026000],
           dtype=int64, length=248)
Traceback (most recent call last):
  File "/Users/tusvn/PycharmProjects/practice/citibike_feature_select_test.py", line 12, in <module>
    X= citibike.index.strftime("%s").astype("int").reshape(-1,1)
AttributeError: Int64Index object has no attribute reshape

修改:

X= citibike.index.strftime("%s").astype("int").values.reshape(-1,1)

 

'Int64Index' object has no attribute 'reshape'

原文:https://www.cnblogs.com/yimiyan/p/12294010.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!