-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
Labels
DeprecateFunctionality to remove in pandasFunctionality to remove in pandasGroupbyNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further action
Description
AFAICT this exists to allow users to apply a different function to each group. I could be convinced that this is worth supporting, but it shouldn't be shoehorned into SeriesGroupBy.aggregate
the way it is.
AFAICT this is not documented, supports only one test (parametrized over 4 dtypes):
@pytest.mark.parametrize("dtype", ["int64", "int32", "float64", "float32"])
def test_basic(dtype):
data = pd.Series(np.arange(9) // 3, index=np.arange(9), dtype=dtype)
index = np.arange(9)
np.random.shuffle(index)
data = data.reindex(index)
grouped = data.groupby(lambda x: x // 3)
[...]
group_constants = {0: 10, 1: 20, 2: 30}
agged = grouped.agg(lambda x: group_constants[x.name] + x.mean())
assert agged[1] == 21
Metadata
Metadata
Assignees
Labels
DeprecateFunctionality to remove in pandasFunctionality to remove in pandasGroupbyNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further action