Transformer for a "groupby" mean with IterativeImputer

Is it possible to use sklearn transformers or similar functions to perform this task:

df['Age'].fillna(df.groupby('Title')['Age'].transform('mean'), inplace=True)

I basically want a filling of NaNs with the means of the titles grouped.

I have everything nicely in pipelines and transformers, and I would like to keep it that way if possible.

Thanks. Kingsley