Listing group information

In one of my courses I have groups of two students working together. I like to be able to have a spreadsheet when the groups do oral presentations, so that I can easily take notes and produce material to use when doing summative evaluations.

The program  Download list_groups_in_course.py

 can be called with a course_id and it produces a spread sheet with pages for "Students" in the course, "Groups" in the course, and two pages which combine this information. The final page "MergeLeft" embeds the user information for each of the groups. There are probably some columns that can be eliminated, but for the moment I have preferred more information over just the information that I might need now. 

To drop columns, list the column headings in a variable (in this case columns_to_drop), then invoke the drop on the data frame whose columns you want to drop. For example:

columns_to_drop=['member_0_short_name', 'member_0_sortable_name', 'member_1_short_name', 'member_1_sortable_name'] 
merged_left_df2.drop(columns_to_drop,inplace=True,axis=1)

Do this before writing the page in the spreadsheet:

merged_left_df2.to_excel(writer, sheet_name='MergeLeft')

An improved version will look at how many members there are in a group and then iterate appropriately. The improved version can handle an arbitrary number of group memebers (it has been tested with up to 10):  Download list_groups_in_course2.py