-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Open
Labels
BugNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team member
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
ser = pd.Series(["2016-01-01"], dtype="date32[pyarrow]")
ser2 = ser.astype("timestamp[ns][pyarrow]")
ser3 = ser.astype("datetime64[ns]")
dti = pd.Index(ser3)
dti.get_loc(ser[0]) # raises KeyError
dti.get_indexer(ser.values) # -1s
dti.get_indexer(ser.values.astype(object)) # 0s; inconsistent
Issue Description
DatetimeIndex.get_indexer has a special case (actually in Index._maybe_downcast_for_indexing) for sequences of date
objects that is inconsistent with both scalar treatment and comparison op behavior. This was mostly benign before the existence of a date dtype, but now has the potential to cause problems. The special case should be deprecated.
Expected Behavior
NA
Installed Versions
Replace this line with the output of pd.show_versions()
Metadata
Metadata
Assignees
Labels
BugNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team member