Quantcast
Channel: Pandas groupby two columns and plot - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Answer by plasmon360 for Pandas groupby two columns and plot

$
0
0

You can also use this

pd.pivot_table(df, values = 'B', index = 'category', columns = 'sex',               aggfunc = lambda x: len(x)).plot.bar()

which results in exactly the same plot.

enter image description here


Viewing all articles
Browse latest Browse all 4

Trending Articles