我很困惑熊貓怎麼吹出界了datetime對象與這些行:大熊貓出界納秒時間戳偏移後前滾加上增加一個月偏移
import pandas as pd
BOMoffset = pd.tseries.offsets.MonthBegin()
# here some code sets the all_treatments dataframe and the newrowix, micolix, mocolix counters
all_treatments.iloc[newrowix,micolix] = BOMoffset.rollforward(all_treatments.iloc[i,micolix] + pd.tseries.offsets.DateOffset(months = x))
all_treatments.iloc[newrowix,mocolix] = BOMoffset.rollforward(all_treatments.iloc[newrowix,micolix]+ pd.tseries.offsets.DateOffset(months = 1))
這裏all_treatments.iloc[i,micolix]
是pd.to_datetime(all_treatments['INDATUMA'], errors='coerce',format='%Y%m%d')
設置日期時間,和INDATUMA
是格式爲20070125
的日期信息。
這個邏輯似乎是在模擬數據進行工作(沒有錯誤,日期意義),所以在那一剎那,它在我的整個數據失敗,出現以下錯誤,我不能重現:
pandas.tslib.OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 2262-05-01 00:00:00
[創建一個最小的,但*完整*代碼示例](http://stackoverflow.com/help/mcve) – jfs