Q:

Select rows based on equal values in different dataframes

How do I select rows based on value overlap in two different dataframes with pandas?
Say that I have two dataframes:
df_A:
latitude    measurement
-8.4        30     
-8.3        40
-8.2        50

df_B:
latitude    measurement
-8.4        40     
-8.2        65
-8.1        53
-8.0        100

I would like to compare measurements taken at the same latitude and create a dataframe that looks like this:
latitude    measurement_A  measurement_B
-8.4        30             40    
-8.2        50             65

I have tried combining the two dataframes into one df_AB like so:
latitude_A    measurement_A   latitude_B   measurement_B
-8.4          30              -8.4         40
-8.3          40              -8.2         65
-8.2          50              -8.1         53
NA            NA              -8.0         100

and then using df.loc:
df_AB.loc[df_AB['latitude_A'] == df_AB['latitude_B']]

however this results in:
latitude     measurement_A   measurement_B
-8.4           30              40

In otherwords, latitude -8.2 is skipped because they are in different rows. How do I go about this? 

A:

Try with this:
df_A.merge(df_B, how='inner', on='latitude')

