Could we sample pandas data frame based on aggregate criteria
a = df[df.contribution <= 0.1].sample(frac = 0.1)
I need to do something like this: take any sample of rows but total contribution from rows should be less than 100 a = df.sample(sum(df['contribution'])<100)
Aucun commentaire:
Enregistrer un commentaire