I am looking to merge 3 dataframes who all have a common 'ORG_ID' column. df1 is my original dataframe and has an org_id count of 154. I would like to merge df1 with df2 and df3 in order to get the ratings for each org id in df1 and am having trouble figuring out how to do this.
I managed to merge df1 and df2 but would get a new count of 84 org_ids instead of 154 because 70 org_ids are not found in df2 but can be found in df3. I cant figure out how to merge all 3 dataframes in order to get a rating for all 154 org_ids in df1. Any ideas? Please keep in mind the dataframes are all different sizes but I am looking to have ratings for ALL 154 original Org_ids found in df1.
Here was my code to merge df1 and df2 :
df4=pd.merge(df1, df2, left_on = 'ORG_ID', right_on = 'ORG_ID')
Here is a sample of what the dataframes look like:
df1:
Org_id Name
123 House 1
457 House 3
876 House 16
567 House 56
df2:
Org_id Name Rating
123 House 1 10
457 House 3 5
857 House 87 6
df3:
Org_id Name Rating1 org_type location area
123 House 1 10 single family Hamilton Suburban
567 House 56 9 single family Middletown Suburban