Pandas - Rolling average for a group across multiple columns; large dataframe
问题 I have the following dataframe: -----+-----+-------------+-------------+-------------------------+ | ID1 | ID2 | Box1_weight | Box2_weight | Average Prev Weight ID1 | +-----+-----+-------------+-------------+-------------------------+ | 19 | 677 | 3 | 2 | - | +-----+-----+-------------+-------------+-------------------------+ | 677 | 19 | 1 | 0 | 2 | +-----+-----+-------------+-------------+-------------------------+ | 19 | 677 | 3 | 1 | (0 + 3 )/2=1.5 | +-----+-----+-------------+-----------