Skip to content

Commit

Permalink
Used anonymous func for rank wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Feb 7, 2018
1 parent 05579af commit cd15bbf
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions pandas/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -2172,15 +2172,6 @@ def get_group_levels(self):
# ------------------------------------------------------------
# Aggregation functions

def _group_rank_wrapper(func, *args, **kwargs):
# Need to explicity unpack *args to support Py < 3.5
# See PEP 448
return func(args[0], args[1], args[2], args[3],
kwargs.get('ties_method', 'average'),
kwargs.get('ascending', True),
kwargs.get('pct', False),
kwargs.get('na_option', 'keep'))

_cython_functions = {
'aggregate': {
'add': 'group_add',
Expand All @@ -2207,7 +2198,12 @@ def _group_rank_wrapper(func, *args, **kwargs):
'cummax': 'group_cummax',
'rank': {
'name': 'group_rank',
'f': _group_rank_wrapper
'f': lambda func, a, b, c, d, **kwargs: func(a, b, c, d,
kwargs.get('ties_method', 'average'),
kwargs.get('ascending', True),
kwargs.get('pct', False),
kwargs.get('na_option', 'keep')
)
}
}
}
Expand Down

0 comments on commit cd15bbf

Please sign in to comment.