Less blocks in groupby by WillAyd · Pull Request #29753 · pandas-dev/pandas (original) (raw)

This isn't complete (2 tests fail) but this is arguably controversial, so putting up for review.

With #29124 we could get rid of the DataFrame aggregation methods that go by blocks. This would hopefully make our code easier to grok and move towards only "one way of doing things" in groupby.

This causes a definite regression for very wide DataFrames with a small number of rows. If you look at the new benchmark created, when testing Frames of N rows x 10_000 columns where N is one of 100, 1000 or 10_000 here are the results:

   before           after         ratio
 [6b3ba986]       [124a135a]
 <categorical-regression>       <easier-groupby>

So drastically slower at 100 rows, but we've already reached a break-even point by the time we get to 10,000 rows.

The rest of the benchmarks don't cover wide data frames that well but here are the results for posterity (I think these are noise)

   before           after         ratio
 [6b3ba986]       [124a135a]
 <categorical-regression>       <easier-groupby>

@jbrockmendel