> For the complete documentation index, see [llms.txt](https://danfo.jsdata.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://danfo.jsdata.org/api-reference/general-functions/danfo.minmaxscaler.md).

# danfo.MinMaxScaler

class danfo.**MinMaxScaler**

danfo.js provides the MinMaxScaler class for standardization of DataFrame and Series. This estimator scales and translates each feature individually such that it is in the given range on the training set, e.g. between zero and one.

This transformation is often used as an alternative to zero mean, unit variance scaling like [Standardscaler](/api-reference/general-functions/danfo.standardscaler.md).

The API is similar to sklearn's [MinMaxScaler](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MinMaxScaler.html?highlight=minmaxscaler#sklearn.preprocessing.MinMaxScaler), and provides a fit and transform method.

## **Examples**

### Standardize DataFrame Object using MinMaxScaler

{% tabs %}
{% tab title="Node" %}

```javascript
const dfd = require("danfojs-node")

let scaler = new dfd.MinMaxScaler()

let data = [[100,1000,2000, 3000] ,
            [20, 30, 20, 10],
            [1, 1, 1, 0]]

let df = new dfd.DataFrame(data)
df.print()

scaler.fit(df)

let df_enc = scaler.transform(df)
df_enc.print()
```

{% endtab %}

{% tab title="Browser" %}

```
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Output" %}

```
╔═══╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╗
║   │ 0                 │ 1                 │ 2                 │ 3                 ║
╟───┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
║ 0 │ 100               │ 1000              │ 2000              │ 3000              ║
╟───┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
║ 1 │ 20                │ 30                │ 20                │ 10                ║
╟───┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
║ 2 │ 1                 │ 1                 │ 1                 │ 0                 ║
╚═══╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╝


 Shape: (3,4) 

╔═══╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╗
║   │ 0                 │ 1                 │ 2                 │ 3                 ║
╟───┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
║ 0 │ 1                 │ 1                 │ 1                 │ 1                 ║
╟───┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
║ 1 │ 0.19191919267...  │ 0.02902902849...  │ 0.00950475223...  │ 0.00333333341...  ║
╟───┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
║ 2 │ 0                 │ 0                 │ 0                 │ 0                 ║
╚═══╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╝
```

{% endtab %}
{% endtabs %}

### Standardize Series Object Using MinMaxScaler

{% tabs %}
{% tab title="Node" %}

```javascript
const dfd = require("danfojs-node")
let scaler = new dfd.MinMaxScaler()

let data = [[100,1000,2000, 3000] ,
            [20, 30, 20, 10],
            [1, 1, 1, 0]]

let df = new dfd.DataFrame(data)
let sf = df.iloc({columns: [0]})

scaler.fit(sf)

let df_enc = scaler.transform(sf)
df_enc.print()
```

{% endtab %}

{% tab title="Browser" %}

```
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Output" %}

```
 Shape: (3,1) 

╔═══╤═══════════════════╗
║   │ 0                 ║
╟───┼───────────────────╢
║ 0 │ 1                 ║
╟───┼───────────────────╢
║ 1 │ 0.19191919267...  ║
╟───┼───────────────────╢
║ 2 │ 0                 ║
╚═══╧═══════════════════╝
```

{% endtab %}
{% endtabs %}

See also [MinMaxScaler](/api-reference/general-functions/danfo.minmaxscaler.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://danfo.jsdata.org/api-reference/general-functions/danfo.minmaxscaler.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
