ค้นหาชื่อแพทย์ทั้งหมดและชื่อแผนกหลักในเครือ
Find the names of all physicians and their primary affiliated departments' names.
df_department = pd.DataFrame(columns = ['name', 'DepartmentID']); df_affiliated_with = pd.DataFrame(columns = ['physician', 'department', 'PrimaryAffiliation']); df_physician = pd.DataFrame(columns = ['name', 'EmployeeID'])
df = df_affiliated_with[df_affiliated_with['PrimaryAffiliation'] == 1]; df_physician.merge(df, left_on='EmployeeID', right_on='physician').merge(df_department, left_on='department', right_on='DepartmentID')[['name_x','name_y']]