Pandas Merge returns NaN
You need same dtype
of joined columns:
#convert first or second to str or int
MergeDat['Motor'] = MergeDat['Motor'].astype(str)
#Motor['Motor'] = Motor['Motor'].astype(str)
#MergeDat['Motor'] = MergeDat['Motor'].astype(int)
Motor['Motor'] = Motor['Motor'].astype(int)
#convert first or second to str or int
#MergeDat['Motor'] = MergeDat['Motor'].astype(str)
Motor['Motor'] = Motor['Motor'].astype(str)
MergeDat['Motor'] = MergeDat['Motor'].astype(int)
#Motor['Motor'] = Motor['Motor'].astype(int)
MergeDat=MergeDat.merge(Motor,how="left")
In my case, it was because I haven't reset the index after splitting the data frame, using df.reset_index(drop=True)
. Resetting the index of the first data frame enabled merging a second data frame to it.