-
- Notifications
You must be signed in to change notification settings - Fork 19.1k
Open
Labels
Arrowpyarrow functionalitypyarrow functionalityBugDatetimeDatetime data dtypeDatetime data dtypeIndexRelated to the Index class or subclassesRelated to the Index class or subclasses
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import io import pandas as pd buf = io.StringIO("date,value\n2024-01-01 00:00:00,1\n2024-02-01 00:00:00,2") df = pd.read_csv(buf, parse_dates=["date"]) df.set_index("date").loc["2024-01"] # works buf = io.StringIO("date,value\n2024-01-01 00:00:00,1\n2024-02-01 00:00:00,2") df = pd.read_csv(buf, parse_dates=["date"], dtype_backend="pyarrow", engine="pyarrow") df.set_index("date").loc["2024-01"] # KeyError
### Issue Description The pyarrow timestamp type gets put into a generic `Index` when assigned via set_index, so the datetime overloads do not work correctly ### Expected Behavior The pyarrow timestamp type should be wrapped by a DatetimeIndex ### Installed Versions 3.0.0.dev0+1696.gfae3e8034f'
dhirschfeld-ffma and robert-schmidtke
Metadata
Metadata
Assignees
Labels
Arrowpyarrow functionalitypyarrow functionalityBugDatetimeDatetime data dtypeDatetime data dtypeIndexRelated to the Index class or subclassesRelated to the Index class or subclasses