pyjanitor
pyjanitor copied to clipboard
[ENH] groupby_agg() axis argument too restrictive?
The Issue
Having some trouble with this line in the current implementation of groupby_agg
In our test suite for this function, we had to get the "count of records in each group" via a complicated numpy call.
We might have wanted to do the same thing with a simpler function call, like so
df.groupby_agg(['date', 'user_id'], 'record_count', 'values', 'count')
But this throws an error
TypeError: count() got an unexpected keyword argument 'axis'
Proposed Change
Taking out the axis=axis portion of the .agg() step, allows for this function call without breaking any of the existing functionality, as far as I (or the unit tests) can tell.
Can anyone help me find a compelling reason not to make this simple change?