SimpleImputer - why not imputer.transform(raw_df[numeric_cols]

Following the comment in the cell: “The missing values in the training, test and validation sets can now be filled in using the transform method of imputer” imputer.transform is applied to the train, validation and test inputs.
would not just be simpler to apply it to the whole dataframe (of course just the numeric columns i.e. imputer.transform(raw_df[numeric_cols])?