Adding grouping to Pandas notebook