I want to calculate the mean of mulptiple rows that have one single value where they match and store it in another csv file. The given data is:
ID salary days_of_work ...
1 2000 3 ...
1 1890 2 ...
1 2109 4 ...
2 .
2 .
2 .
2
3
3
...
And then obtain in another file, for every ID, one single row that contains the mean of the datas of the other columns like this:
ID salary days_of_work ...
1 1999.6667 3 ...
2 ...
3 ...
.
.
.
Update:
I tried to do this but for a file that has utc_time instead of ID
import pandas as pd
keep_col = ['utc_time','temperature','pressure','humidity','wind_direction','wind_speed/kph']
pd.read_csv('Gridpoints.csv', names=keep_col).to_csv("GridPoints/test.csv", index=False)
f=pd.read_csv("Gridpoints"+".csv")
df = f[keep_col]
df.groupby(['utc_time']).mean()
df.to_csv("GridPoints/test.csv", index=False)
So first what I do is getting a column deleted and then on the dataframe obtained, I want to do it for the utc_time column but it doesn't do anything