Incorrect result when using get_level_values on datetime index #1704

Closed
kdebrab opened this Issue Jul 30, 2012 · 2 comments

2 participants

@kdebrab

Pandas 0.8.1:

import pandas as pd
import datetime as dt
tuples = [(dt.datetime(2012,1,1),1),(dt.datetime(2012,1,1),2),(dt.datetime(2012,1,2),1),(dt.datetime(2012,1,2),2)]
index = pd.MultiIndex.from_tuples(tuples)
index.get_level_values(level=0)

incorrectly returns:

array([1970-01-16 224:00:00, 1970-01-16 224:00:00, 1970-01-16 248:00:00,
       1970-01-16 248:00:00], dtype=datetime64[ns])
@changhiskhan
Python for Data member

Are you on NumPy 1.6.x? The repr for the datetime64[ns] dtype is buggy in that version and I think that's what you're running into.

@kdebrab

Indeed, I am using NumPy 1.6.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment