Fix groupby().transform() example in cookbook.rst
@jorisvandenbossche : Fixes code in example, and makes final averaging by len(x) stylistically similar to previous adds.
New pull request replacing my earlier one, which contained some other erroneous commits.
closes #8944 

@SteveSimmons thanks!

fyi, you don't need to open a new PR in general, just edit and force push the old one to replace.
 Thanks Jeff. I have some time this weekend and will try to do another couple of 0.15.2 issues. Can you let me know if I should focus on particular ones? Don't want to duplicate effort of others

On 5 December 2014 02:11:25 GMT+00:00, jreback notifications@github.com wrote:

> Merged #9007.
> 
> ---
> 
> Reply to this email directly or view it on GitHub:
> https://github.com/pydata/pandas/pull/9007#event-203047697

## 

Sent from my Android device with K-9 Mail. Please excuse my brevity.
