码迷,mamicode.com
首页 > 其他好文 > 详细

'Int64Index' object has no attribute 'reshape'

时间:2020-02-11 11:37:29      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:报错   span   pychar   val   python   erro   bsp   基础教程   学习   

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'

标签:报错   span   pychar   val   python   erro   bsp   基础教程   学习   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!