You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When reading in a dfsu (and other dfs* files - not tested) and converting to Pandas datetime with dates before 1677-09-22 and beyond 2262-04-11 an error is flagged:
OutOfBoundsDatetime: Out of bounds nanosecond timestamp
To Reproduce
data = {
"company":{"0":"Comp1","2":"Comp2"},
"date":{"0":'2020-01-01',"2":'2500-01-01'},
"sales":{"0":"17","2":"27"}}
df = pd.DataFrame(data)
pd.to_datetime(df['date'])
Error:
OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 2500-01-01 00:00:00, at position 1.
ecomodeller
changed the title
Read dfsu for future dates: Out of bounds nanosecond timestamp error
Read dfsu for future dates (beyond year 2262): Out of bounds nanosecond timestamp error
Feb 1, 2024
I will close this for now, I am under the impression that this is a niche need. @fveeden if you have this need, please submit a PR and we can work this out together.
Describe the bug
When reading in a dfsu (and other dfs* files - not tested) and converting to Pandas datetime with dates before 1677-09-22 and beyond 2262-04-11 an error is flagged:
OutOfBoundsDatetime: Out of bounds nanosecond timestamp
To Reproduce
data = {
"company":{"0":"Comp1","2":"Comp2"},
"date":{"0":'2020-01-01',"2":'2500-01-01'},
"sales":{"0":"17","2":"27"}}
df = pd.DataFrame(data)
pd.to_datetime(df['date'])
Error:
OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 2500-01-01 00:00:00, at position 1.
This is a Pandas bug: pandas represents timestamps in nanosecond resolution,
the timespan that can be represented using a 64-bit integer is limited to approximately 584 years
'1677-09-22 00:12:43.145225' to '2262-04-11 23:47:16.854775807'
see: https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#timestamp-limitations
Need to get a work around in order to read the data at least and possibly reconstruct the dataframe with the correct time series.
The text was updated successfully, but these errors were encountered: