You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This looks really messy, it's not difficult to find out inconsistent behavior in all three methods. It seems to me that the dataframe implementation is too liberally blurring the distinction between agg, transform and apply.
@memeplex : Thanks for reporting this! Just for reference, did you notice this "inconsistent" behavior in previous versions of pandas, or has this surfaced just now (you use the word "new" in the title)?
Regarding df.apply, we don't actually say that we accept lists of functions, so that behavior is somewhat accidental. Nevertheless, I don't see why we couldn't implement for groupby's?
Regarding df.transform, your groupby transform call should have worked according to documentation, so that looks like a bug to me.
Regarding df.agg, that looks like a bug to me as well. While lambda x: x is vacuously an aggregation, it should work for groupby as well AFAICT.
I have tested it with 0.21 only but transform and agg were acquired by df in 0.20 so the behavior can't be older than that. It's not surprising given the fact that the current implementation mostly delegates everything to _aggregate.
I'm not sure allowing apply to receive a full mapper as part of its "public" signature is a good idea since the difference between the three methods is becoming almost impossible to describe (e.g. I don't see how the "more flexible" role the traditional groupby documentation assigns to apply is relevant anymore for dfs).
This looks really messy, it's not difficult to find out inconsistent behavior in all three methods. It seems to me that the dataframe implementation is too liberally blurring the distinction between agg, transform and apply.
dataframe.apply
accepts lists and dicts whilegroupby.apply
doesn't:dataframe.transform
disallows aggregations whilegroupby.transforms
broadcasts them to the original shape:dataframe.agg
allows non-aggregations whilegroupby.agg
doesn't:The text was updated successfully, but these errors were encountered: