以下のソースコードのようにpandasのastype()を使ってデータフレームの複数のカラムを型変換しようとしたのですが
python
1df = df.astype({'time': str, 'num': int})
以下のようなエラーがでました。
"TypeError: object of type 'type' has no len()"
どのようにすれば実行できますか?
以下が実行環境です。
・python 2.7.13 :: Anaconda 4.0.0(64-bit)
・Ubuntu 14.04
・df.head()の結果
time num
0 2018-2-15 00:00:00 1
1 2018-2-15 00:01:00 2
2 2018-2-15 00:02:00 3
3 2018-2-15 00:03:00 4
4 2018-2-15 00:04:00 5
回答1件
あなたの回答
tips
プレビュー