Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditional Statement based on value of a different column

I am trying to efficiently add another element to this code below, that takes into account the value of another column in this df.

Below I have a filter if the value column is >= 0, but I want to add an element that says if the column called day = 'Friday', thanks.

df[df['value']] >= 0

like image 966
Chris90 Avatar asked Nov 18 '25 03:11

Chris90


1 Answers

use this

df[(df['value']>=0) & (df['day']=='friday') ]
like image 189
tawab_shakeel Avatar answered Nov 21 '25 10:11

tawab_shakeel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!