Here is an example df
:
names count x y
02.3 89 va1 31
02.3 44 va1 22
01.8 15 va2 12
01.8 17 va2 3
03.3 24 va3 3
03.3 21 va3 9
I want to calculate mean count
for two categories of names
. 02.3
and 01.8
should be amended as high
and 03.3
as low
. I also want to keep all other columns in that df
. So, my output would be like this:
names count x y
high 41.25 va1 31
high 41.25 va1 22
high 41.25 va2 12
high 41.25 va2 3
low 22.5 va3 3
low 22.5 va3 9
How can I do this?