Použijte pandas.DataFrame.merge
s how='left'
:
final_list = pd.merge(first_list, second_list, on='identifier', how='left')
print(final_list)
name identifier BIC BANK
0 Firstname 1201 DNBANKNOKK DNB Bank ASA
1 Secondname 0 UNKNOWN Unknown
2 Thirdname 1855 EIDSNO21 Eidsberg Sparebank
3 Fourthname 3333 RYGSNO21 Sparebank1 Østfold Akershus
4 Fifthname 1414 LOSKNO21 Sparebank 1 Lom og Sjåk
Dobré rozsáhlé vysvětlení o merging
v pandas
najdete zde:
Pandas Merging 101