Skip to content

BUG: Out of bound dates can be saved to feather but not loaded #47832

Closed
@adrienpacifico

Description

@adrienpacifico

Pandas version checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of pandas.
  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
from datetime import datetime
df = pd.DataFrame({"date": [
    datetime.fromisoformat("1654-01-01"),
    datetime.fromisoformat("1920-01-01"),
],})
df.to_feather("to_trash.feather")
pd.read_feather("to_trash.feather")

Issue Description

Does not return the original dataframe but raise an issue instead.

ArrowInvalid: Casting from timestamp[us] to timestamp[ns] would result in out of bounds timestamp: -9971942400000000

Expected Behavior

return the original dataframe df.

Installed Versions

INSTALLED VERSIONS ------------------ commit : e8093ba python : 3.9.13.final.0 python-bits : 64 OS : Linux OS-release : 5.8.0-7630-generic Version : #32~1609193707~20.10~781bb80-Ubuntu SMP Tue Jan 5 21:29:56 UTC 2 machine : x86_64 processor : byteorder : little LC_ALL : None LANG : C.UTF-8 LOCALE : en_US.UTF-8

pandas : 1.4.3
numpy : 1.23.1
pytz : 2022.1
dateutil : 2.8.2
setuptools : 58.1.0
pip : 22.0.4
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 8.4.0
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
markupsafe : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 8.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None

Metadata

Metadata

Assignees

Labels

BugIO Parquetparquet, featherNeeds TestsUnit test(s) needed to prevent regressions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions