I have a Pandas DataFrame named df
and in df['salary']
column, there are 400 values represented by same number -999
. I want to replace that -999
value with any number in between 200
and 500
. I want to replace all 400 values with a different number from 200 to 500. So far I have written this code:
df['salary'] = df['salary'].replace(-999, random.randint(200, 500))
but this code is replacing all -999 with the same value. I want all replaced values to be different from each other. How can do this.