我ENV:python3.6_x64,熊貓0.17.0或更新版本,numpy的1.12.0如何將pd.Series轉換爲datetime?
代碼:
>>> import pandas as pd
>>> import numpy as np
>>> df_date = pd.Series(['2017-3-1','2017-3-2'])
>>> df_date
0 2017-3-1
1 2017-3-2
>>> pd.to_datetime(df_date)
錯誤:
ValueError: Error parsing datetime string "2017-3-1" at position 5
...
SystemError: <class 'str'> returned a result with an error set
我更新大熊貓0.19.2,和同樣的錯誤.. –
工程於'0.18.1' – Zero
運行完美的'0.19.2' – jezrael