@Substitution(name='groupby')
    @Appender(_doc_template)
    def tail(self, n=5):
        mask = self._cumcount_array(ascending=False) < n
        return self._selected_obj[mask]
Returns last n rows of each group
dataset/ETHPy150Open pydata/pandas/pandas/core/groupby.py/GroupBy.tail