0

我的数据中一定有错误的日期,但我宁愿继续将其设置为缺失。但是,我试图强迫它失败了,我看不到其他选择。有什么可做的?

相关线路是:

all_treatments['date'] = pd.to_datetime(all_treatments['INDATUMA'], format='%Y%m%d', coerce=True)

错误是:

Traceback (most recent call last):
 File "treatments3_noiopro.py", line 76, in <module>
   all_treatments['date'] = pd.to_datetime(all_treatments['INDATUMA'], format='%Y%m%d', coerce=True)
 File "/home/seidav/anaconda/lib/python2.7/site-packages/pandas/tseries/tools.py", line 340, in to_datetime
   values = _convert_listlike(arg.values, False, format)
 File "/home/seidav/anaconda/lib/python2.7/site-packages/pandas/tseries/tools.py", line 333, in _convert_listlike
   raise e
ValueError: day is out of range for month

我在 Linux 下使用版本 pandas 0.16.2 np19py26_0、iopro 1.7.1 np19py27_p0 和 python 2.7.10 0。

4

0 回答 0