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 Name1.lastname1@domain.com
. 525 Name2.lastname2@domain.com
. 665 Name3.lastname3@domain.com
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 Name1.lastname1@domain.com 1131222
. 525 Name2.lastname2@domain.com 8658685
. 665 Name3.lastname3@domain.com 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