ค้นหาชื่อนักศึกษาที่จะเรียนวิชาบัญชีและข้อมูลคอมพิวเตอร์ แผนกระบบ
Find the first name of student who is taking classes from accounting and Computer Info. Systems departments
df_class = pd.DataFrame(columns=['class_code', 'crs_code']); df_enroll = pd.DataFrame(columns=['stu_num', 'class_code']); df_department = pd.DataFrame(columns=['dept_code', 'dept_name']); df_course = pd.DataFrame(columns=['crs_code', 'dept_code']); df_student = pd.DataFrame(columns=['stu_fname', 'stu_num'])
df_accounting = df_student[df_student['stu_num'].isin(df_enroll[df_enroll['class_code'].isin(df_class[df_class['crs_code'].isin(df_course[df_course['dept_code'].isin(df_department[df_department['dept_name'] == 'Accounting']['dept_code'])])]['class_code'])]['stu_num'])]['stu_fname']; df_cis = df_student[df_student['stu_num'].isin(df_enroll[df_enroll['class_code'].isin(df_class[df_class['crs_code'].isin(df_course[df_course['dept_code'].isin(df_department[df_department['dept_name'] == 'Computer Info. Systems']['dept_code'])])]['class_code'])]['stu_num'])]['stu_fname']; pd.concat([df_accounting, df_cis]).drop_duplicates(keep=False)