df_switch = pd.concat([split_sorted.str[0], split_sorted.str[1], df[
    'volume']], axis=1, keys=['country1', 'country2', 'volume'])
df_switch.groupby(['country1', 'country2'], as_index=False, sort=False).sum()
Combining similar rows in Stata / python