How to create a new column in a Pandas DataFrame based on a column in another DataFrame?

I am new to Python and Pandas

I need to do the following

I have 2 DataFrames, lets call them df1 and df2

df1

Index    Req ID  City_Atlanta   City_Seattle    City_Boston Result  
 0        X         1                0            0           0  
 1        Y         0                1            0           0  
 2        Z         0                0            1           1

df2

Index    Req_ID    City        
  0         X      Atlanta     
  1         Y      Seattle     
  2         Z      Boston    

I want to add a column in df2 called result such that df2.result = False if df1.result = 0 and df2.result = True if df1.result = 1

The final result should look like df2

Index    Req_ID    City       result 
  0         X      Atlanta     False
  1         Y      Seattle     False
  2         Z      Boston      True


#python #pandas

1 Likes1.75 GEEK