i need help, i have a csv file with the following columns:
Date Tipology inputDates dayOfWeek
0 2018-01-01 200 2018-01-01 Monday
1 2018-01-02 93 2018-01-02 Tuesday
2 2018-01-03 382 2018-01-03 Wednesday
3 2018-01-04 147 2018-01-04 Thursday
4 2018-01-05 107 2018-01-05 Friday
... ... ... ... ...
360 2018-12-27 155 2018-12-27 Thursday
361 2018-12-28 148 2018-12-28 Friday
362 2018-12-29 129 2018-12-29 Saturday
363 2018-12-30 129 2018-12-30 Sunday
364 2018-12-31 147 2018-12-31 Monday
I would like to sum tipology by dayOfWeek, I'm doing:
groupweek = df1.groupby(['dayOfWeek','Tipology']).count()
groupweek
and I receive
Date inputDates
dayOfWeek Tipology
Friday 107 1 1
113 1 1
117 1 1
118 1 1
119 1 1
.........................
Monday 104 1 1
111 1 1
113 1 1
118 1 1
..........................
etc. etc
in theory I thought that adding up all the types of Friday Monday etc ect I obtained how many types (of numerical sum occurred per day of the week) but this does not happen, so I'm not sure that by doing this below I get what I want :?
in:
groupweek = df1.groupby(['dayOfWeek'],as_index=False)['Tipology'].sum()
groupweek
out:
dayOfWeek Tipology
0 Friday 8356
1 Monday 9245
2 Saturday 8685
3 Sunday 8489
4 Thursday 8629
5 Tuesday 8959
6 Wednesday 9273
Are the numeric tipology values grouped and summed based on the dayofweek for the year 2018?
With count() (there should be all 52 Fridays, 52 Mondays etc etc) adding them does not give the result of sum().