I have a pandas dataframe df that looks like this:
>>>df
group A B C
1 1 2 3
1 2 3 6
1 4 9 9
2 8 1 2
2 5 6 4
3 6 5 7
I would like it multi-indexed so it looks like
group
A B C
1 1 2 3
2 3 6
4 9 9
2 8 1 2
5 6 4
3 6 5 7
I'd like to access each group number gives me a dataframe of just the values for that group index. What I mean is if I type df[0] then I get
>>>df[0]
A B C
1 2 3
2 3 6
4 9 9
and I can do the usual functions, like take the mean via df[0].mean()
I'm sure this is possible but reading the pandas help pages and looking through forums seems to have solutions for people who already created multi-indexed dataframes with tuples.