Skip to content

Commit cd15bbf

Browse files
committed
Used anonymous func for rank wrapper
1 parent 05579af commit cd15bbf

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

pandas/core/groupby.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -2172,15 +2172,6 @@ def get_group_levels(self):
21722172
# ------------------------------------------------------------
21732173
# Aggregation functions
21742174

2175-
def _group_rank_wrapper(func, *args, **kwargs):
2176-
# Need to explicity unpack *args to support Py < 3.5
2177-
# See PEP 448
2178-
return func(args[0], args[1], args[2], args[3],
2179-
kwargs.get('ties_method', 'average'),
2180-
kwargs.get('ascending', True),
2181-
kwargs.get('pct', False),
2182-
kwargs.get('na_option', 'keep'))
2183-
21842175
_cython_functions = {
21852176
'aggregate': {
21862177
'add': 'group_add',
@@ -2207,7 +2198,12 @@ def _group_rank_wrapper(func, *args, **kwargs):
22072198
'cummax': 'group_cummax',
22082199
'rank': {
22092200
'name': 'group_rank',
2210-
'f': _group_rank_wrapper
2201+
'f': lambda func, a, b, c, d, **kwargs: func(a, b, c, d,
2202+
kwargs.get('ties_method', 'average'),
2203+
kwargs.get('ascending', True),
2204+
kwargs.get('pct', False),
2205+
kwargs.get('na_option', 'keep')
2206+
)
22112207
}
22122208
}
22132209
}

0 commit comments

Comments
 (0)