df = pandas.DataFrame({'s1_x': scipy.randn(10), 's1_y': scipy.randn(10),
    's2_x': scipy.randn(10), 's2_y': scipy.randn(10)})
df.columns = pandas.MultiIndex.from_tuples([tuple(c.split('_')) for c in df
    .columns])
Reshaping dataframes in pandas based on column labels