0

I've just upgraded to pandas 1.1 from 0.24 and I feel like I have lost my mind. Is it true that you can no longer index a DatetimeIndex with, you know, a date?

#This now fails!
import datetime as dt
s = pd.Series([1,2], pd.DatetimeIndex([dt.date(2020,1,1),dt.date(2020,1,2)]))
s.loc[dt.date(2020,1,2)]
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-49-18ac6239cd3a> in <module>
      1 s = pd.Series([1,2], pd.DatetimeIndex([dt.date(2020,1,1),dt.date(2020,1,2)]))
----> 2 s.loc[dt.date(2020,1,2)]
....

Please tell me I'm wrong!

Dave Anderson
  • 667
  • 1
  • 7
  • 14

1 Answers1

1

It's a bug that's going to be fixed in 1.1.1

https://github.com/pandas-dev/pandas/issues/35466

Dave Anderson
  • 667
  • 1
  • 7
  • 14