I have a dataframe
     O   D  counts
0   G1  G1    8576
1   G1  G2    4213
2   G1  G3    8762
3   G2  G1    8476
4   G2  G2    2134
...
But each of the groups have different populations in O and D. So for example:
G1 in O has, say, 1234 different members, while G1 in D has 4321.
How do I normalize the above table using pandas?
 
    