grouped = df.groupby('foo')
for name,group in grouped:
print(name)
print(group)
For DataFrames explicitly specify a column as the filter criterion.
df.groupby('bar').sum()
df.groupby('bar').filter(lambda x: x['baz'].sum() == 5)
Return the items that have two rows.
df.groupby('quux').groups
df.groupby('quux').filter(lambda x: len(x) == 2)