Closed
Description
It seems that the groupby
operation fails when the row index is a MultiIndex containing NaT values. For example, the following code fails (v0.15.2) with TypeError: 'numpy.ndarray' object is not callable
:
midx = pd.MultiIndex(levels=[[pd.NaT, pd.datetime(2012,1,2),
pd.datetime(2012,1,3)], ['a', 'b']],
labels=[[0, 1, 1, 2], [0, 0, 1, 0]], names=['date', None])
df = pd.Series(pd.np.random.rand(4), index=midx)
df.groupby(level=1)
However, it seems as though np.nan values are handled properly:
midx = pd.MultiIndex(levels=[[pd.np.nan, 10, 20], ['a', 'b']],
labels=[[0, 1, 1, 2], [0, 0, 1, 0]], names=['date', None])
df = pd.Series(pd.np.random.rand(4), index=midx)
df.groupby(level=1)