-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
IndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionTimezonesTimezone data dtypeTimezone data dtype
Description
dti = pd.date_range("2016-01-01", periods=3)
dti2 = dti.tz_localize("UTC").tz_convert("US/Pacific")
>>> dti.get_loc(dti2[0])
0
>>> dti2.get_loc(dti[0])
KeyError: Timestamp('2016-01-01 00:00:00-0800', tz='US/Pacific', freq='D')
ser = pd.Series(range(3), index=dti)
ser2 = pd.Series(range(3), index=dti2)
>>> ser.loc[dti2[1]]
1
>>> ser2.loc[dti[1]]
KeyError: Timestamp('2016-01-02 00:00:00-0800', tz='US/Pacific', freq='D')
get_loc is effectively an equality check, so I think it should behave like all our other comparisons and require tzawareness-compat. So all of these would raise KeyError.
xref #17920, #30819 (comment)
mroeschke
Metadata
Metadata
Assignees
Labels
IndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionTimezonesTimezone data dtypeTimezone data dtype