df.groupby(as_index=bool) affects .agg('sum') but not .transform('sum')
from docstring:
```
as_index : bool, default True
    For aggregated output, return object with group labels as the
    index. Only relevant for DataFrame input. as_index=False is
    effectively "SQL-style" grouped output.
```

```python
In [26]: df=pd.DataFrame(dict(price=[10,10,20,20,30,30],color=[10,10,20,20,30,30],cost=(100,200,300,400,500,600)))
    ...: # makes a difference - result index is a multindex of groups
    ...: print(df.groupby(['price','color'],as_index=True).agg('sum'))
    ...: print(df.groupby(['price','color'],as_index=False).agg('sum')) 
10    10      300
20    20      700
30    30     1100
   price  color  cost
0     10     10   300
1     20     20   700
2     30     30  1100

In [30]:# does not makes a difference - result index is just a default RangeIndex
    ...: print(df.groupby(['price','color'],as_index=True).transform('sum'))
    ...: print(df.groupby(['price','color'],as_index=False).transform('sum'))
   cost
0   300
1   300
2   700
3   700
4  1100
5  1100
   cost
0   300
1   300
2   700
3   700
4  1100
5  1100
```