我有以下数据帧:
df = pd.DataFrame({'Date':['01/01/2021','08/01/2021'],
'a_score':[7,3],
'b_score':[2,4],
'a':['north','south'],
'b':['south','north']})
Date a_score b_score a b
01/01/2021 7 2 north south
08/01/2021 3 4 south north
我应该如何最好地调整格式,将a和b两列数据堆叠在一起,同时将a_score和b_score也堆叠在一起?期望的输出如下:
Date Region score score_against
01/01/2021 north 7 2
01/01/2021 south 2 7
08/01/2021 north 4 3
08/01/2021 south 3 4
非常感谢。