Skip to content Skip to sidebar Skip to footer

Generate Different Random Numbers To Multiple Rows In A Column

I got a columns with integer values(n rows). I want to generate random numbers that range from a normal distribution on values that meet certain condition. I tried with code below

Solution 1:

You're missing the "size" argument that will give the shape of the random values to be generated.

df_members[df_members['bd'] == -99999] = np.random.normal(bd_mean, bd_sd,len(df_members[df_members['bd'] == -99999])) 

will give you what you want

Post a Comment for "Generate Different Random Numbers To Multiple Rows In A Column"