Data science

Instead of nesting, you can first assign the grouped data to a variable, say `grouped` and then call the `each_with_object` on the next line. It will be easier to read.