I am grouping by panda frame based on two columns and adding the sum of a third column to this groupby object. It works perfectly, but I am trying to figure out how should I iterate through this returned object.
Below is the command I used to groupby and sum.
groupby_abundance=df.groupby(['mi','Organism_name'])[['Rep_Abun']].sum()
print groupby_abundance
This is the output from above print.
Rep_Abun
mi Organism_name
mi1023 Daylily 9
mi1030 Maize 642
Kniphofia 17
Nymphaea 133
mi1083 Liriope 6
mi1097 Kniphofia 6
mi1098 Coconut 95
I want to iterate through groupby_abundance
.
Thanks for helping in advance.