However, regarding this trouble
a. fit_transform -- The mean() and std () -- they are learned parameters and are directly applied to the initial data
b. transform -- This is applied to new data, i.e, the previously learned parameters applied to new data, usually test data
Why couldn't you use it?
The fit_transform() functions in two ways:
cal. mean and st for standardscaler -- fit phase
transform phase --- using these parameters, it applies the transformation
The transform() fails due to the following
Scaler may not have learned any parameters
The scaler didn't know which mean() and std() to use
Check official documentation for more https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.StandardScaler.html