I' m rather new to programming and this community. Hopefully can one of you help me, because i'm a stuck.
I have a df
that looks as follows:
Time | Location | day | direction | speed
08:00| 143.3 | Mo | L | 120.0
08:00| 143.3 | Mo | L | 110.0
09:00| 143.3 | Mo | L | 120.0
09:00| 143.3 | Mo | L | 100.0
09:00| 143.3 | Mo | L | 110.0
09:00| 143.3 | Mo | R | 121.2
I want to merge the rows IF the Time
and Location
and day
and direction
are the same as another row. If this is all TRUE
: it should merge and take the mean
of the speed into a single row.
So it should be looking like this:
Time | Location | day | direction | speed
08:00| 143.3 | Mo | L | 115.0
09:00| 143.3 | Mo | L | 110.0
09:00| 143.3 | Mo | R | 121.2
Can anyone help me with this?
ps. Sorry for the poor display of the df
! I will edit this.