Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Keyword aggregation in SeriesGroupBy #26512

Closed
TomAugspurger opened this issue May 24, 2019 · 0 comments

Comments

@TomAugspurger
Copy link
Contributor

commented May 24, 2019

Followup to #26399

In [1]: df = pd.DataFrame({'A': [1, 1, 1, 2, 2], 
   ...:                      'B': range(5), 
   ...:                      'C': range(5)})                                    

In [2]: df                                     
Out[2]: 
   A  B  C
0  1  0  0
1  1  1  1
2  1  2  2
3  2  3  3
4  2  4  4

In [3]: df.groupby('A').B.agg(foo='count')                                                        
Out[3]: 
   foo
A     
1    3
2    2

#26399 (review)

@TomAugspurger TomAugspurger added this to the 0.25.0 milestone May 24, 2019

@TomAugspurger TomAugspurger referenced this issue May 29, 2019
0 of 2 tasks complete

TomAugspurger added a commit to TomAugspurger/pandas that referenced this issue May 30, 2019

ENH: Named aggregation in SeriesGroupBy.agg
```python
In [4]:    animals = pd.DataFrame({'kind': ['cat', 'dog', 'cat', 'dog'],
   ...:                            'height': [9.1, 6.0, 9.5, 34.0],
   ...:                            'weight': [7.9, 7.5, 9.9, 198.0]})
   ...:    animals.groupby("kind").height.agg(max_height='max')
Out[4]:
      max_height
kind
cat          9.5
dog         34.0
```

Closes pandas-dev#26512

TomAugspurger added a commit to TomAugspurger/pandas that referenced this issue May 30, 2019

ENH: Named aggregation in SeriesGroupBy.agg
```python
In [4]:    animals = pd.DataFrame({'kind': ['cat', 'dog', 'cat', 'dog'],
   ...:                            'height': [9.1, 6.0, 9.5, 34.0],
   ...:                            'weight': [7.9, 7.5, 9.9, 198.0]})
   ...:    animals.groupby("kind").height.agg(max_height='max')
Out[4]:
      max_height
kind
cat          9.5
dog         34.0
```

Closes pandas-dev#26512
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.