In [2]:
df
Out[2]:
foo bar baz qux quux
0 one A 1 6 a
1 one B 2 5 b
2 one C 3 4 b
3 two A 4 3 c
4 two B 5 2 c
5 two C 6 1 c
In [3]:
df.groupby('foo').groups
Out[3]:
{'one': [0, 1, 2], 'two': [3, 4, 5]}
In [4]:
grouped = df.groupby('foo')
for name,group in grouped:
    print(name)
    print(group)
one
   foo bar  baz  qux quux
0  one   A    1    6    a
1  one   B    2    5    b
2  one   C    3    4    b
two
   foo bar  baz  qux quux
3  two   A    4    3    c
4  two   B    5    2    c
5  two   C    6    1    c
In [5]:
grouped.get_group('one')
Out[5]:
foo bar baz qux quux
0 one A 1 6 a
1 one B 2 5 b
2 one C 3 4 b