2021年5月1日星期六

How to update null values at Random in pandas

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
https://stackoverflow.com/questions/67352615/how-to-update-null-values-at-random-in-pandas May 02, 2021 at 11:01AM

没有评论:

发表评论