I am using python and pandas.
I have:
df1: df2:
|index | ID | |index | ID | name |
| 1 | 34 | | 1 | 35 | Astri |
| 2 | 35 | | 2 | 36 | Carlos|
| 3 | 36 | | 3 | 34 | Xim |
So, i want somthing like this using isin():
df1:
|index | ID | name |
| 1 | 34 | Xim |
| 2 | 35 | Astri |
| 3 | 36 | Carlos |
The function I am using is this. I can tell if the ID of df1 exists in df2, but I am unable to assign the 'name' column of df2, to df1
df1 = df1[df1.ID.isin(df2.ID)]
I don't want to have to iterate using a FOR and iterrows(), because I will apply this to a dataset of eight million records. Thank you!