How to update null values at Random in pandas
Something like this on column of interest
pd.Series(range(10)).mask(np.random.random(10)<0.5)
I am trying to add null values at random to a pandas data for a specific column to perform testing on the data.
For example if i have a dataframe with below values.




id
total_distance




1
1000


1
2000


3
4000


4
5000


5
10000




How to pass null values at random like below




id
total_distance




1
1000


1
2000


3
4000


4
NaN


5
10000