-
-
Couldn't load subscription status.
- Fork 19.2k
Closed
Labels
BugGroupbyMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateNeeds TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressionsgood first issue
Milestone
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)Roon
Metadata
Metadata
Assignees
Labels
BugGroupbyMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateNeeds TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressionsgood first issue