'Merging two pandas dataframes while keeping data from the first one in python

I have 2 of the following tables that show x- and y-position as well as the intensity and size of a particle as it moves through frames. I want to compare these two tables and combine them into one. My first table is called green_masked_tracks and my second is red_masked_tracks. I would like to create a table with the following:

I would like to merge on the x, y, and frame columns to combine them into one table, but I still want to keep the extra values from the green table that are not duplicated with the red table. In summary, I have two sets of tracks (red and green), and I want to merge them together where they are similar while keeping the green tracks even if the red is not present. If I use pandas.dataframe.merge(), it removes all of the green tracks that are not duplicated in the red tracks.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source