模拟 数据
signup.csv
employee_id,name,sex,department,item_id
NC001,liming,f,functional,N100
NC002,zhangsan,f,functional,N101
NC003,sunli,m,functional,N103
NC004,lina,m,functional,N103
NC005,wanger,m,technology,N101
NC006,shenteng,m,technology,N100
NC007,mali,f,technology,N102
NC008,reba,f,technology,N102
NC009,ailun,m,technology,N102
NC010,changyuan,m,technology,N102
NC011,geyou,m,technology,N103
NC012,cls,f,technology,N103
items.csv
item_id,item_name,location
N100,athletics,area01
N101,longJump,area02
N102,highJump,area03
N103,javelin,area04
N104,pingPong,area05
N105,relayRace,area06
实现代码
import pandas as pd

signup = pd.read_csv('signup.csv')
items = pd.read_csv('items.csv')

df_all = pd.merge(signup, items,
                  how='left',
                  left_on=signup['item_id'],
                  right_on=items['item_id'])
print(df_all.query(" department == 'functional' & item_name == 'javelin'").loc[:,
      ['employee_id', 'name', 'sex']].reset_index(drop=True))