I have this dataset as a pandas DataFrame with multiIndex:
cnt
loginsmonth 2014-02-01 2014-03-01 2014-04-01 2014-05-01
app regmonth
1 2014-02-01 6069 1837 107 54
2014-03-01 0 10742 2709 1387
2014-04-01 0 0 5584 1103
2014-05-01 0 0 0 5584
I need to transform it into a percentual value related to the diagonal:
cnt
loginsmonth 2014-02-01 2014-03-01 2014-04-01 2014-05-01
app regmonth
1 2014-02-01 6069/6069 1837/6069 107/6069 54/6069
2014-03-01 0 10742/10742 2709/10742 1387/10742
2014-04-01 0 0 5584/5584 1103/5584
2014-05-01 0 0 0 5584/5584