idx = df.index.str[0]
col = df.columns
head = np.dstack(('{}_'.format(idx[0]) + col, '{}_'.format(idx[1]) + col)
    ).ravel()
pd.DataFrame(df.values.reshape(1, 32, order='F'), columns=head)
how to convert the format of a dataframe from two rows to single