Standardize features by removing the mean and scaling to unit variance.
class danfo.StandScaler
danfo.js provides the StandardScaler class for the standardization of DataFrame and Series. The standard score of a sample x is calculated as:
z = (x - u) / s
where u is the mean of the training samples or zero if with_mean=False, and s is the standard deviation of the training samples or one if with_std=False.
The API is similar to sklearn's StandardScaler, and provides a fit and transform method.
Examples
Standardize Series Object
constdfd=require("danfojs-node")let scaler =newdfd.StandardScaler()let sf =newdfd.Series([100,1000,2000,3000])sf.print()scaler.fit(sf)let sf_enc =scaler.transform(sf)sf_enc.print()