# How does transform work?

I was looking at the source codes of MinMaxScaler on Github. I know that when you fit a preprocessing class to a dataset, it takes the data and prepares it for transformation.

Let's say, I fitted MinMaxScaler to X_train and transformed it. But how does transform work when I use another dataset, let's say X_test? When you call transform(), does it replace the datasets in the use?

• Thanks for the answer, but I'm interested in how the code works. For example, the fit method does nothing other than returning partial_fit. To be precise, it first resets the internal state and then returns partial_fit. If transform uses fit for transforming, why doesn't it take partial_fit as input? May 4 at 21:25