dimanche 24 mars 2019

Pandas is condition on multiple columns

I have a dataframe

col1    col2    col3    col4
A         F      F      F
B         F      A      B
C         B      A      C
D         S      A      F

I want to say if A and F in any of these columns then make a new column and enter "Found"

col1    col2    col3    col4   output
A         F      F      F        Found
B         F      A      B        Found
C         B      A      C           0
D         S      A      F        Found

Aucun commentaire:

Enregistrer un commentaire