Pandas sum across columns and divide each cell from that value

More simply:

result.div(result.sum(axis=1), axis=0)

Leave a Comment