Skip to content

TST/COMPAT: update csv test to infer time with pyarrow>=6.0 #44381

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

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions pandas/compat/pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
pa_version_under3p0 = _palv < Version("3.0.0")
pa_version_under4p0 = _palv < Version("4.0.0")
pa_version_under5p0 = _palv < Version("5.0.0")
pa_version_under6p0 = _palv < Version("6.0.0")
Copy link
Member

Choose a reason for hiding this comment

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

I think also need to add pa_version_under6p0 = True below

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, yes, thanks

except ImportError:
pa_version_under1p0 = True
pa_version_under2p0 = True
pa_version_under3p0 = True
pa_version_under4p0 = True
pa_version_under5p0 = True
pa_version_under6p0 = True
6 changes: 6 additions & 0 deletions pandas/tests/io/parser/test_parse_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
is_platform_windows,
np_array_datetime64_compat,
)
from pandas.compat.pyarrow import pa_version_under6p0

import pandas as pd
from pandas import (
Expand Down Expand Up @@ -431,6 +432,11 @@ def test_date_col_as_index_col(all_parsers):
columns=["X0", "X2", "X3", "X4", "X5", "X6", "X7"],
index=index,
)
if parser.engine == "pyarrow" and not pa_version_under6p0:
# https://github.com/pandas-dev/pandas/issues/44231
# pyarrow 6.0 starts to infer time type
expected["X2"] = pd.to_datetime("1970-01-01" + expected["X2"]).dt.time

tm.assert_frame_equal(result, expected)


Expand Down