I have following application on pandas' groupby.apply method
import pandas as pd
dat = pd.DataFrame({'name' : ['A', 'C', 'A', 'B', 'C'], 'val' : [1,2,1,2,4]})
dat.groupby('name').apply(lambda x : x)
This gives result as
name val
0 A 1
1 C 2
2 A 1
3 B 2
4 C 4
However I wanted to get the dataframe corresponding to i-th group. For example, for the first group I intend to get dataframe with name = 'A' etc.
Is there any method available to achieve the same?