题解 | #统计职能部分运动会某项目的报名信息#
统计职能部分运动会某项目的报名信息
https://www.nowcoder.com/practice/607359f8e09f4128bb90bb28a08d42ca
import pandas as pd items = pd.read_csv('items.csv',sep = ',') signup = pd.read_csv('signup.csv',sep = ',') # 表连接之前先筛选条件,优化性能 df1 = items.loc[items.item_name=='javelin'] df2 = signup.loc[signup.department =='functional'] df = pd.merge(df1,df2,on = 'item_id',how='left') # 筛选 print(df[['employee_id','name','sex']].reset_index(drop = True))