Skip to content

TST: add a test on mixed offsets for read_csv #54245

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
Changes from 2 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
14 changes: 14 additions & 0 deletions pandas/tests/io/parser/test_parse_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2237,3 +2237,17 @@ def test_parse_dates_arrow_engine(all_parsers):
}
)
tm.assert_frame_equal(result, expected)


def test_from_csv_with_mixed_offsets():
Copy link
Member

Choose a reason for hiding this comment

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

does it work to use the

parser = all_parsers

and then

parser.read_csv

pattern from the other tests in this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it works very well, except pyarrow. I added @xfail_pyarrow.

content = "a\n2020-01-01T00:00:00+01:00\n2020-01-01T00:00:00+00:00"
result = read_csv(StringIO(content), parse_dates=["a"])["a"]
expected = Series(
[
Timestamp("2020-01-01 00:00:00+01:00"),
Timestamp("2020-01-01 00:00:00+00:00"),
],
name="a",
index=[0, 1],
)
tm.assert_series_equal(result, expected)