'how to merge in pandas with 4 columns

I have 2 Dataframe in pandas. I want to merge but, I need to do it by 4 columns. Somenthing like that:

DF 1:

doc, cod_doc, name, city

DF 2:

id, cod_id, income

I need doing merge for doc = id and cod_doc = cod_id.

This is my code:

f = pd.merge(customers_adress, customers_income,left_on='doc',right_on='id',how='left') 


Solution 1:[1]

f = pd.merge(
customers_adress, customers_income, 
left_on=['doc', 'cod_doc'],
right_on=['id', 'cod_id',
how='left'
) 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kylian