I have a dataframe that has two columns: DNI, Email.
And I have another one that has: first name, last name, num
This is the data structure:
dataframe 1:
DNI email
. 1 [email protected]
. 525 [email protected]
. 665 [email protected]
dataframe 2:
first name last name num
. name2 lastname2 8658685
. name1 lastname1 1131222
I want to add the num column to the first dataframe depending on the mail and if the name and last name combination does not exist for the email column I want to add "0" value and it looks like this:
DNI email num
. 1 [email protected] 1131222
. 525 [email protected] 8658685
. 665 [email protected] 0
I'm not sure what is the correct way to do this... I'm thinking to do this using for loops, adding values to a dictionary depending on some conditionals but this logic is inefficient with large Dataframes
any idea to do this in a better way?
Thanks