Closed paul-lilley closed 6 years ago
This is the expected behavior. See the Timestamp Limitations section of the documentation, as well as the Representing Out-of-Bounds Spans section for a workaround using period_range
/PeriodIndex
.
Thanks - the Representing Out-of-Bounds Spans section gives a good hint for how issue #20927 might be resolved.
Code Sample, a copy-pastable example if possible
Problem description
This causes import of some SAS datasets to fail, and potentially imports/conversions from other sources (such as DB2) where an arbitrarily high date (often 9999-12-31) is used in datawarehousing to indicate currently valid rows with a to_date=9999-12-31
see related issue #20927 - reposted here as the issue is more generic than just SAS dataset imports and maybe #15836
I'm pretty sure the root cause is because to_datetime() converts via nanoseconds ( in _libs.tslibs.timedeltas.cast_from_unit ) and very large dates in nanoseconds do not fit into int64 space.
Expected Output
correctly parsed dates up to and including 9999-12-31
Output of
pd.show_versions()