I have a question. I have two data set as under,
df1
Sl No Address
1 1111
2 2222
3 2345
4 7890
5 0987
6 3456
7 1233
df2
email Add.
AA A123
AA 1111
AA 99999
BB a9999
BB 345689
BB 345699
CC 1233
I'm trying to merge the two dataframe based on address column and bring column named email to the df1.
I have renamed the column, and passed the merge function as under.
df2.rename(columns = {'Add.':'Address'}, inplace = True)
df1 = df1.merge(df2['email'],how="left", on = "Address")
I'm not sure why but i'm getting a key error
~\anaconda3\lib\site-packages\pandas\core\generic.py in _get_label_or_level_values(self, key, axis)
1682 values = self.axes[axis].get_level_values(key)._values
1683 else:
-> 1684 raise KeyError(key)
1685
1686 # Check for duplicates
KeyError: 'Address'
I verified the files, column named "Address" is present in the source file. Not sure why merge function is saying otherwise. Note - Both the address columns in df1 and df2 are objects
Help would be appreciated!