I have a dataframe that looks like this:
N | Place | Number | C | H | E | G | D |
---|---|---|---|---|---|---|---|
1 | Angus | 25 | 33 | 45 | 23 | 60 | 43 |
2 | Argyl | 43 | 23 | 12 | 56 | 19 | 45 |
3 | Ayrsh | 14 | 46 | 27 | 92 | 14 | 12 |
and i want to create a function which iterates through 'C', 'H', 'E', 'G', 'D', and creates a new dataframes where the row values are replaced with the mean, eg: meanC = 33/25, meanH = 45/25, meanE = 23/25.
I am not quite sure how to go about it.Any help would be appreciated, thankyou!