In a pandas dataframe, how can I drop a random subset of rows that obey a condition?
In other words, if I have a Pandas dataframe w
Using drop with sample
drop
sample
df.drop(df[df.Label.eq(1)].sample(2).index) Label A 0 0 1 1 0 2 2 0 3 3 1 10 5 1 12