I need some help with a data frame.
Pop L6L Size A1 GG 78 A2 GA 4 A2 GG 71 A3 GA 63 A3 GG 8 B2 GA 8 B2 GG 289 B3 GG 24 B4 GG 69 B5 AA 6 B5 GA 4 B5 GG 2 C1 GG 65
In the column 'l6l', I have three elements that are shared among the populations (pop). I wish to set those instances as column name, the population column groupedby so that the size of the elements shall fill the new columns. The data frame I am expecting should looks like this:
L6L
Pop GG GA AA
A1 78 0 0
A2 71 4 0
A3 8 63 0
B2 289 8 0
B3 24 0 0
B4 69 0 0
B5 2 4 6
C1 65 0 0
I tried to groupby l6l, to no avail because nothing showed up. l6l1 = l6l.groupby(['L6L']) l6l1 <pandas.core.groupby.generic.DataFrameGroupBy object at 0x7f8d595f60d0>
Is there another possible way to do it? Thank you.