I have merged two Pandas dataframes (course schedule and student evaluations) via an inner join. I then produce a .groupby() dataframe of course section by course by instructor. Lastly, I compute the .mean() for questions 1 through 4 and print the results. How can I write these results, multiindex, column titles, and analysis, to a ReportLab Table for output to a pdf?
merged_df = pd.merge(left=evals_df, right=sched_df, left_on='Course', right_on='Course')
byInstructor_df = merged_df[['Q1', 'Q2', 'Q3', 'Q4']].groupby([merged_df['PRIMARY_INSTRUCTOR_NAME'],
merged_df['COURSE_NUMBER'], merged_df['OFFERING_NUMBER']])
print(byInstructor_df.mean())
Current output using print:
Bird, B 3302 1 4.38 2.62 4.62 4.62
Grouch, O 2201 2 4.23 2.69 4.00 4.23
3 4.68 3.42 4.42 4.42
3303 2 3.80 2.85 3.25 3.65
4425 1 4.50 3.50 4.00 4.88
Monster, C 3312 1 4.52 3.22 4.09 4.22
Thanks for any guidance. -Tom