I have a dataframe that looks like this:
DayOfWeek Sunday Monday Tuesday Wednesday Thursday Friday Saturday
00 0.0 0.0 0.0 19.0 0.0 4.0 0.0
01 0.0 0.0 0.0 0.0 0.0 7.0 0.0
07 0.0 0.0 3.0 5.0 3.0 0.0 1.0
08 0.0 17.0 16.0 8.0 10.0 1.0 0.0
09 10.0 48.0 30.0 86.0 12.0 3.0 0.0
10 70.0 58.0 3.0 36.0 52.0 70.0 0.0
11 32.0 26.0 0.0 20.0 38.0 42.0 0.0
12 21.0 9.0 83.0 32.0 129.0 57.0 0.0
13 53.0 51.0 55.0 36.0 18.0 32.0 0.0
14 64.0 62.0 24.0 21.0 53.0 61.0 0.0
15 46.0 121.0 37.0 31.0 58.0 54.0 0.0
16 95.0 139.0 86.0 58.0 79.0 11.0 0.0
17 113.0 56.0 73.0 146.0 78.0 17.0 0.0
and I want to make it as precentage, so I want to sum each column, and in each cell I want to divide in the sum of the column so I did this code:
df_day = df_day.apply(lambda x: round(100 * x / df_day.groupby('DayOfWeek').size().sum()))
but it doesn't work...
any ideas please?