This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add only 1 column (City) | |
table1_city=table1.merge(table2[['Person ID','City']],how='left',on='Person ID') | |
#Add all columns of table 2 (City and language) | |
table1_all=table1.merge(table2,how='left',on='Person ID') | |
#One liner to fill Nans | |
table1_fill_nans=table1.merge(table2[['Person ID','City']],how='left',on='Person ID').fillna('Unknown') |