Quantcast
Channel: Active questions tagged row - Stack Overflow
Viewing all articles
Browse latest Browse all 473

How to extract from a dataframe rows only if values in a column are higher than values in another colum?

$
0
0

I have the following dataframe

df = pd.DataFrame({'a': [100, 200, 300, 400],'b': [80, 250, 500, 350]})print(df)     a    b0  100   801  200  2502  300  5003  400  350

I would like to extract the rows only if the value of the column 'a' is higher than the value of the 'b' column.

So in my example I should get as result this dataframe:

     a    b0  100   803  400  350

Thanks


Viewing all articles
Browse latest Browse all 473

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>