dimanche 10 juillet 2016

multiple bar plots from pandas dataframe


So I have a data frame like

exp_name, index, items, clicks
"foo",0, "apple",200
"foo",0, "banana", 300
"foo",0,"melon",220
"foo",1, "apple", 10
"foo",1,"peach", 20
"bar",0, "apple",400
"bar",0,'banana', 500
"bar",0, "melon",240
"bar",1,"apple",500

and so on

I want to plot... for each experiment name... bar plots of number of clicks for each item in each index but colored by index. So basically.. plot 1.. for experiment "foo", a bar plots.. where index == 0.. all the barplots for index 0 in one color.. index 1 in another color.

if the item is missing (for example peach is in "foo", 1 but not in any other place) replace "peach" to be zero in other places.


Aucun commentaire:

Enregistrer un commentaire