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
Correct me if I'm wrong, but isn't Series.agg supposed to reduce all rows to a singular value and Series.apply supposed to apply an operation to each individual row? Currently, when a function doesn't throw one of ValueError, AttributeError, TypeError, it is assumed to be a function meant for Series.apply even when passed to Series.agg.
This generates exactly the same series as before because the function is called with individual values instead of the whole frame. When used in conjunction with another aggregator, like mean, it crashes since it can't concatenate a singular value with a series.
Correct me if I'm wrong, but isn't
Series.agg
supposed to reduce all rows to a singular value andSeries.apply
supposed to apply an operation to each individual row? Currently, when a function doesn't throw one ofValueError, AttributeError, TypeError
, it is assumed to be a function meant forSeries.apply
even when passed toSeries.agg
.Consider the following example:
This generates exactly the same series as before because the function is called with individual values instead of the whole frame. When used in conjunction with another aggregator, like mean, it crashes since it can't concatenate a singular value with a series.
pandas/pandas/core/apply.py
Lines 1040 to 1051 in c293caf
Why would somebody ever call
Series.agg
with a function that only works on singular values?The text was updated successfully, but these errors were encountered: