TransWikia.com

How to downsample a dataset with constraints in Python?

Data Science Asked by Mr.cysl on January 10, 2021

I have a dataset that has columns a, b, and others. Both a and b are numerical values, for example,

       a b c d e ...
row_0  2 5 .....
row_1  6 3 .....
...

I am hoping to downsample the dataset from total rows n to n_d, while changing the ratio of sum(a)/sum(b) to a given value, e.g., sum(a_d)/sum(b_d) = 1.5. Is there a package or method I could use to achieve this goal?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP