having a simple pandas data frame with 2 columns e.g. id and value where value is either 0 or 1 I would like
id
value
0
1
you can probably use numpy.random.choice:
>>> idx = df.index[df.value==1] >>> df.loc[np.random.choice(idx, size=idx.size/10, replace=False)].value = 0