Tôi đang bối rối như thế nào gấu trúc thổi ngoài giới hạn cho các đối tượng datetime với những dòng này:gấu trúc nằm ngoài giới hạn nano giây timestamp sau khi bù đắp rollforward cộng thêm một tháng bù đắp
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))
Đây all_treatments.iloc[i,micolix]
là một datetime do pd.to_datetime(all_treatments['INDATUMA'], errors='coerce',format='%Y%m%d')
, và INDATUMA
là thông tin ngày theo định dạng 20070125
.
Logic này dường như làm việc trên dữ liệu giả (không có lỗi, ngày có ý nghĩa), vì vậy tại thời điểm này tôi không thể tái tạo trong khi nó không thành công trong toàn bộ dữ liệu của tôi với các lỗi sau:
pandas.tslib.OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 2262-05-01 00:00:00
[tạo ra một tối thiểu nhưng * hoàn * mã ví dụ] (http://stackoverflow.com/help/mcve) – jfs