Skip to content
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pandas/tests/io/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,3 +674,19 @@ 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.Series(
pd.to_datetime(["20/12/2025", pd.NaT, "31/12/2020"], dayfirst=True)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
expect_data = pd.Series(
pd.to_datetime(["20/12/2025", pd.NaT, "31/12/2020"], dayfirst=True)
)
expect_data = pd.to_datetime(["20/12/2025", pd.NaT, "31/12/2020"], dayfirst=True)

expect = pd.DataFrame({"date": expect_data})

assert (result["date"].dtype) == "datetime64[s]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert (result["date"].dtype) == "datetime64[s]"

This is done in assert_frame_equal

tm.assert_frame_equal(expect, result)