I have some data imported from csv, to create something like this I used this:
data = pd.DataFrame([[1,0,2,3,4,5],[0,1,2,3,4,5],[1,1,2,3,4,5],[0,0,2,3,4,5]], columns=['split','sex', 'group0Low', 'group0High', 'group1Low', 'group1High']) means = data.groupby(['split','sex']).mean()
therefore, the data structure looks something like this:
group0Low group0High group1Low group1High split sex 0 0 2 3 4 5 1 2 3 4 5 1 0 2 3 4 5 1 2 3 4 5
You will notice that each column contains two variables (group # and height). (He was set up this way to run repeated anova measurements in SPSS.)
I want to break the columns up, so I can also group the βgroupβ like this (I really sharpened the order of the numbers, but hopefully the idea is clear):
low high split sex group 0 0 95 265 0 0 1 123 54 1 0 120 220 1 1 98 111 1 0 0 150 190 0 1 211 300 1 0 139 86 1 1 132 250
How do I achieve this?