按组颠倒元素的顺序

假设我有一个像这样的DataFrame:

import pandas as pd

df = pd.DataFrame({'a': [1,1,1,1,2,2,2,2], 'b': [1,2,3,4,5,6,7,8]})

看起来像这样

   a  b
0  1  1
1  1  2
2  1  3
3  1  4
4  2  5
5  2  6
6  2  7
7  2  8

I would like to reverse its elements within each group, where column a determines the group. So, the desired output would be

   a  b
0  1  4
1  1  3
2  1  2
3  1  1
4  2  8
5  2  7
6  2  6
7  2  5

我怎样才能做到这一点?