I have the dataframe with some values that are only different in salary section and first column is id. so I want to group using id as well as find the mean of salary while keeping other attributes that contains similar values as it is. It's like squeezing the data by calculating the mean of salary.
id | name | salary | age |
---|---|---|---|
1 | amit | 5000 | 23 |
1 | amit | 8000 | 23 |
1 | amit | 5000 | 23 |
2 | joseph | 5600 | 22 |
2 | joseph | 4800 | 22 |
2 | joseph | 7000 | 22 |
3 | nina | 3600 | 24 |
3 | nina | 2500 | 24 |
3 | nina | 5000 | 24 |
Output I want :-
id | name | salary | age |
---|---|---|---|
1 | amit | 6000 | 23 |
2 | joseph | 5800 | 22 |
3 | nina | 3700 | 24 |