'merging dataframes depending on values
I have two dataframes with different sizes and I'd like to merge them.
Now I'd like to merge them, that the height values of the first columns are corresponding. 15.0 with 15.0 and so on. The missing values should be filled with NaNs or interpolated.
Is there a nice way of doing that without checking every value in a for loop?
Would appreciate any suggestions.
Thanks J.
Solution 1:[1]
You could try using a left join with pd.merge() so that you keep everything on the 1st dataframe
Example:
#left_df will represent your first dataframe
#right_df will represent your second dataframe
pd.merge(left_df, right_df, left_on = "height", right_on = "height_radio", how = "left")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

