Add useful code comments to groupby including pythonic implementation