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] Parse arrow_dtype as datetime index #60097

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Changes from 9 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
28 changes: 28 additions & 0 deletions pandas/tests/io/parser/test_parse_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,34 @@ def test_parse_dates_arrow_engine(all_parsers):
tm.assert_frame_equal(result, expected)


def test_parse_dates_arrow_dtype_as_index(all_parsers):
# GH#57930
parser = all_parsers
data = """a,b
2000-01-01 00:00:00,1
2000-01-01 00:00:01,1"""

result = parser.read_csv(
StringIO(data),
parse_dates=["a"],
index_col="a",
dtype_backend="pyarrow",
)
expected = pd.DataFrame(
[1, 1],
columns=["b"],
dtype="int64[pyarrow]",
index=Index(
[
Timestamp("2000-01-01 00:00:00"),
Timestamp("2000-01-01 00:00:01"),
],
name="a",
),
)
tm.assert_series_equals(result, expected)
MCRE-BE marked this conversation as resolved.
Show resolved Hide resolved


@xfail_pyarrow # object dtype index
def test_from_csv_with_mixed_offsets(all_parsers):
parser = all_parsers
Expand Down
Loading