For the complete documentation index, see llms.txt. This page is also available as Markdown.

danfo.StandardScaler

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

const dfd = require("danfojs-node")

let scaler = new dfd.StandardScaler()

let sf = new dfd.Series([100,1000,2000, 3000])
sf.print()

scaler.fit(sf)

let sf_enc = scaler.transform(sf)
sf_enc.print()

Standardize DataFrame Object

See also MinMaxScaler

Last updated