Q:

Correct way to look up missing values from one dataframe in another

I have a dataframe with 2 fields, including "name" and "team" called "df1". I want to add an additional column called "user_id" based on each person's user_id which can be found in a separate dataframe based on that person's "team".
The "user_id" values can be found in other dataframes which are separated by the team field, named "df_a", "df_b", "df_c"... etc. Each of these dataframes contains the same three fields ("name", "team", and "user_id"), but each one only contains names from that team, and each of these dataframes is complete (no NaNs found in any columns). 
I was wonder what the most pythonic way was to add the "user_id" column to df1 using the data from my team dataframes (there could be many team dataframes, but each is relatively small). Thus far, I've tried looping through each team dataframe and merging them onto df1 based on the "name" field using inner and left merges, but the output ends up either missing rows from the original dataframe or outputting many "user_id_x", "user_id_y" columns filled with NaNs.
Example dataframes:
df1: 
               name  team     
0          john doe     a       
2          jane doe     b          
3           amy doe     b         
4        jane smith     c         
5      john johnson     c         

df_a:
               name  team     user_id  
0          john doe     a       15368
1        john smith     a       15382
2       sally smith     a       15212

df_b: 
               name  team     user_id  
0          jane doe     b        6325
1           amy doe     b        6164
2         sally doe     b        6294

df_c: 
               name  team     user_id 
0         steve doe     c       52956
1        jane smith     c       83635  
2      john johnson     c       54871

This is my desired output after taking the user_id values from each team dataframe:
               name  team      user_id   
0          john doe     a        15368
2          jane doe     b         6325
3           amy doe     b         6164  
4        jane smith     c        83635  
5      john johnson     c        54871

Let me know if there is anything I can clarify, and thanks in advance!

A:

try this,
main_df=pd.concat([df_a,df_b,df_c],ignore_index=True)
df=pd.merge(df,main_df,how='left',on=['name','team'])

concat all df_x dataframes then perform left join
Output:
           name team  user_id
0      john doe    a    15368
1      jane doe    b     6325
2       amy doe    b     6164
3    jane smith    c    83635
4  john johnson    c    54871

Output for     print (main_df):
           name team  user_id
0      john doe    a    15368
1    john smith    a    15382
2   sally smith    a    15212
3      jane doe    b     6325
4       amy doe    b     6164
5     sally doe    b     6294
6     steve doe    c    52956
7    jane smith    c    83635
8  john johnson    c    54871

