How Does Group By Work In Python