```
        id      vi       dates     f_id
0  5532714  0.549501  2015-07-07    ff_22
1  5532715  0.540969  2015-07-08    ff_22
2  5532716  0.531477  2015-07-09    ff_22
3  5532717  0.521029  2015-07-10    ff_22
4  5532718  0.509694  2015-07-11    ff_22

```

In the dataframe above, I want to find average yearly value for each year. This does not work:

```
df.groupby(df.dates.year)['vi'].transform(mean)

```

I get this error: `*** AttributeError: 'Series' object has no attribute 'year'`
How to fix this?