I have 2 dataframes that have some features in common but labeled differently. I'd like to create another dataframe with columns from both dataframes. The idea for the selection is that if
col1_df1 == col1_df2 & col2_df1 == col2_df2
then the row must be selected. I used this code but I don't know if it is working properly.
Can you help me?
pd.merge(data2_single_route,
data,left_on=['nodeid','res_time_start_s','res_time_end_s'],
right_on=['nodeid','ts_start','ts_end'],how='inner')
Imagine that in dataframe 1 I have this:
10:00, 11:00, 1 , 'a'
11:00 , 13:00 , 2, 'b'.
In the dataframe 2 I have:
10:00 11:00 , 1 , '1500'
11:00 , 12:00 , 2 , '6000'.
The output that i want is:
10:00 , 11:00 , 1 , 'a' , 1500