update 'groupby' function
'groupby' passing PEP8