Nans After Merging Two Dataframes
I have two dataframes like the following: df1 id name ------------------------- 0 43 c 1 23 t 2 38 j 3 9
Solution 1:
Problem is you need convert column id in df2 to int, because output of string functions is always string, also if works with numeric.
df2.id = df2.id.astype(int)
Another solution is convert df1.id to string:
df1.id = df1.id.astype(str)
And get NaNs because no match - str values doesnt match with int values.
Post a Comment for "Nans After Merging Two Dataframes"