This imputation fills train's missing value with 25.0 — a number computed from ALL rows, including the test set's 40.0. That's leakage: information from data the model must never see, baked into training. Fix the fill to use train rows only.
The break is on line 4 — but read the whole snippet first.