I have produced the below code to add the aggregated values for each group. How and where to do this correctly. Now, instead of modifying table_data inside add_aggregated_rows(), we retrieve the group totals as a list and insert them at the right place. Continue reading...