I have a nested dictionary, eg;
dictionary = {'cat_1' : {'age' : 5, 'height' : 15}, 'cat_2' : {'age' : 1, 'height' : 7}, 'dog_1' : {'age' : 13, 'height' : 20}, 'dog_2' : {'age' : 9, 'height' : 18}}
I want to find the average values of the inner dictionary keys for each type of animal, by grouping the outer id keys (using something like key.split('_')[0]).