'Int64Index' object has no attribute 'reshape'

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)

 

posted on 2020-02-11 10:20  依米艳  阅读(2324)  评论(0编辑  收藏  举报

导航