I have an arbitrary DataFrame of size 2000 x 2000. Is it possible to compress this into a smaller DataFrame where each element represents the mean of a small block of the original DataFrame without using loops? The block size can be anything but for the sake of this question assume it is 40 rows and 50 columns so that the resulting DataFrame has 50 rows and 40 columns.
I've tried extending the answer here but something is not clicking for me. Thanks!