I have a dataset that contains out layer and I wanted to replace them with the median value. This is my dataset
id Age
10236 766105
11993 288
9337 205
38189 88
35555 82
39443 75
10762 74
33847 72
21194 70
39450 70
I am trying to replace the value which is greater than 75 with the median value.
To achieve that I am using the following steps:
- replace the values which are greater than 75 with 0
- then replace 0 with a median value
I used the code below to achieve but it's giving me the desired result.
df['age'].replace(df.age>75,0,inplace=True)