Extended groupby with filters