I would like to add some group properties as a new column to a pandas dataframe but without beaking the chain. I know this is possible in R using dplyr but I cannot get it to work in pandas.

The dplyr code would be (for adding max of column B per group in column A):

```
df %>%
   group_by(A) %>%
   mutate(max = max(B)) %>%
   ungroup() %>%
   ... more operations

```

The only way I can get it to work in pandas is:

```
df['max'] = df.groupby('A')['B'].transform('max')

```

but this requires a seperate line to assign the new column while I would like to do it inside a chain. Any help would be appreciated.