Following this example I can create a simple dataframe and groupby
import pandas as pd
# Create a sample data frame
df = pd.DataFrame({'A': ['foo', 'foo', 'foo', 'bar', 'bar'],
'B': range(5), 'C': range(5)})
# group by 'A' and sum 'B'
gf = df.groupby('A').agg({'B': 'sum'})
The result is the grouped dataframe gf
B
A
bar 7
foo 3
I would like to access gf by the grouped indices. Something like...
gf['foo'] returns 3
gf['bar'] returns 7
I would also like to plot by the grouped indices. Something like...
gf.plot('A', 'B') such that x=['foo','bar'], y=[3,7]