-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
BugCategoricalCategorical Data TypeCategorical Data TypeGroupbyNeeds TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressionsgood first issue
Milestone
Description
This should exit the interpreter.
In [1]: import pandas as pd
In [2]: df = pd.DataFrame({"A": pd.Categorical(['a', 'a'], categories=['a', 'b']),
...: "B": [1, 1]})
...:
In [3]: import sys
In [4]: def f(x):
...: if len(x) == 0:
...: sys.exit(1)
...: return len(x)
...:
In [5]: df.groupby('A').agg(f)
Out[5]:
B
A
a 2.0
b NaNInstead, I think groupby assumes the output of the custom aggfunc is NaN.
Metadata
Metadata
Assignees
Labels
BugCategoricalCategorical Data TypeCategorical Data TypeGroupbyNeeds TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressionsgood first issue