BUG: DatetimeIndex indexing fails at nanosecond precision if timezone is used · Issue #13908 · pandas-dev/pandas (original) (raw)
DatetimeIndex
fails to find its own values if a timezone is used:
index = pd.DatetimeIndex(['2016-06-28 08:30:00.123456789'], dtype='datetime64[ns, America/Chicago]')
df = pd.DataFrame({'a':[10]}, index=index)
df.loc[df.index[0]]
It fails with:
*** KeyError: 'the label [2016-06-28 08:30:00.123456789-05:00] is not in the [index]'
This is impossible.
It works if you use only microseconds rather than nanoseconds, and it works if you don't set a timezone.
Pandas 0.18.1.