Skip to content

BUG: DatetimeIndex indexing fails at nanosecond precision if timezone is used #13908

Closed
@jzwinck

Description

@jzwinck

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDuplicate ReportDuplicate issue or pull requestIndexingRelated to indexing on series/frames, not to indexes themselvesTestingpandas testing functions or related to the test suiteTimezonesTimezone data dtype

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions