I want to simulate a variable which can have values between 0 and 1. But I also want that this random variable to have 80% zeroes. Currently I ma doing the following:
data['response']=np.random.uniform(0,1,15000)#simulate response data['response']=data['response'].apply(lambda x:0 if x<0.85 else x) But this results in only the extreme values(0 and .8+) in the variable. I want to have 80 percent zeroes and rest 20% rows to have values between zero and one. This has to be done randomly.