mercredi 29 avril 2020

Multiple condition in pandas dataframe - np.where

I have the following dataframe

Year          M  
1991-1990     10
1992-1993      9

What I am trying to so is a if statement: =IF(M>9,LEFT(Year),RIGHT(C2,4))*1

So basically if M if 10 choose the left value of the column year else choose the second value

I tried using np.where but I have no idea how to choose between two values in the same column.

Help?

Aucun commentaire:

Enregistrer un commentaire