LoginSignup
2
1

More than 3 years have passed since last update.

'Int64Index' object has no attribute 'reshape'の解決法

Posted at

はじめに

オライリージャパンの「Pyhtonではじめる機械学習」のp.238にて,citibikeの時刻データをPOSIX時刻に変換するコードで以下のようなエラーが発生した.

X = citibike.index.astype("int64").reshape(-1,1) //10**9

エラー内容

AttributeError: 'Int64Index' object has no attribute 'reshape'

解決法

以下のように元のコードにvaluesを加えると解決できます.

X = citibike.index.astype("int64").values.reshape(-1,1) //10**9

どうも自分の持っている書籍の版が古いらしく,おそらく修正前のやつであるっぽいですね...(いろいろとエラーが多いと感じる笑)

2
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1