In [6]:
grouped.ngroup()
Out[6]:
0    0
1    0
2    0
3    1
4    1
5    1
dtype: int64
In [7]:
sc = lambda x: (x - x.mean()) / x.std()*10
grouped.transform(sc)
Out[7]:
baz qux
0 -10 10
1 0 0
2 10 -10
3 -10 10
4 0 0
5 10 -10
In [8]:
grouped.transform(sc)
Out[8]:
baz qux
0 -10 10
1 0 0
2 10 -10
3 -10 10
4 0 0
5 10 -10
In [9]:
ngroup = pd.Series(grouped.ngroup(), name= 'foo_ngroup')
cumcount = pd.Series(grouped.cumcount(), name= 'foo_cumcount')
rank = pd.Series(grouped['baz'].rank(), name= 'foo_rank')
sc = grouped.transform(sc).rename(columns=lambda x: x + '_sc')

pd.concat([df, ngroup, cumcount, rank, sc], axis=1)
Out[9]:
foo bar baz qux quux foo_ngroup foo_cumcount foo_rank baz_sc qux_sc
0 one A 1 6 a 0 0 1.0 -10 10
1 one B 2 5 b 0 1 2.0 0 0
2 one C 3 4 b 0 2 3.0 10 -10
3 two A 4 3 c 1 0 1.0 -10 10
4 two B 5 2 c 1 1 2.0 0 0
5 two C 6 1 c 1 2 3.0 10 -10