Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: Add test for pd.read_csv date parsing not working with dtype_backend="pyarrow" and missing values #60286

14 changes: 14 additions & 0 deletions pandas/tests/io/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,3 +674,17 @@ def test_pickle_reader(reader):
# GH 22265
with BytesIO() as buffer:
pickle.dump(reader, buffer)


@td.skip_if_no("pyarrow")
def test_pyarrow_read_csv_datetime_dtype():
# GH 59904
data = '"date"\n"20/12/2025"\n""\n"31/12/2020"'
result = pd.read_csv(
StringIO(data), parse_dates=["date"], dayfirst=True, dtype_backend="pyarrow"
)

expect_data = pd.to_datetime(["20/12/2025", pd.NaT, "31/12/2020"], dayfirst=True)
expect = pd.DataFrame({"date": expect_data})

tm.assert_frame_equal(expect, result)