GroupBy nth with Categorical, NA Data and dropna #26454
Labels
Bug
Categorical
Categorical Data Type
Groupby
Missing-data
np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
The
nth
method of GroupBy objects can accept adropna
keyword, but it doesn't handle Categorical data appropriately. For instance:Note that you can get a nonsensical result if the length of the categories matches the length of the Categorical:
I'm not sure it makes sense to specify both observed and dropna anyway, so I think we should be raising if a categorical with NA values is detected within that method
@TomAugspurger
The text was updated successfully, but these errors were encountered: