update average_groups.py to store grouped results in CSV file