Which measurement reliably isolates Python call overhead in pandas groupby.apply?
0 reputation · 17 Aug 2023, 16:52 UTC
Goal and context
The goal is to quantify the runtime contribution of groupby.apply in pandas before selecting an alternative implementation. The concern is distinguishing Python function call overhead from pandas internal data handling for realistic workloads.
Constraints and open design
Measurement interpretation is sensitive to data size, function complexity and dtypes. Small inputs can exaggerate interpreter effects, and results vary with the specific user function. There is also an open design question about whether pandas should automatically infer and vectorize user-defined functions passed to groupby.apply, which affects the trade-off between flexibility and performance.
Which timing and profiling methods reliably separate user function time from pandas internals for groupby.apply? Does the current pandas behavior provide a stable baseline for comparing against groupby.agg or groupby.transform? What is the current status of the design discussion on automatic vectorization of user-defined functions in groupby.apply?