ค้นหาชื่อและตำแหน่งของแพทย์ที่สั่งจ่ายยาบางชนิดยี่ห้อ X?
Find the name and position of physicians who prescribe some medication whose brand is X?
df_medication = pd.DataFrame(columns = ['code', 'Brand']); df_prescribes = pd.DataFrame(columns = ['physician', 'medication']); df_physician = pd.DataFrame(columns = ['name', 'position', 'employeeid'])
df_medication_codes = df_medication[df_medication['Brand'] == 'X']['code']; df_physician_ids = df_prescribes[df_prescribes['medication'].isin(df_medication_codes)]['physician']; df_physician[df_physician['employeeid'].isin(df_physician_ids)][['name', 'position']]