模拟数据
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,shenteng,m,functional,N100
NC006,mali,f,functional,N102
NC007,reba,f,functional,N102
NC008,ailun,m,functional,N102
NC009,changyuan,m,functional,N102
NC010,geyou,m,functional,N103
NC011,cls,f,functional,N103
NC012,dahai,m,functional,N101
items.csv
item_id,item_name,location
N100,athletics,area01
N101,longJump,area02
N102,highJump,area03
N103,javelin,area04
N104,pingPong,area05

实现代码:
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.groupby('item_name')['employee_id'].count())