# DataFrame.applyMap

danfo.DataFrame.applyMap(callable, options)

| Parameters | Type     | Description                                                           | Default   |
| ---------- | -------- | --------------------------------------------------------------------- | --------- |
| callable   | Function | Function to apply to each column or row                               |           |
| options    | Object   | **axis**: 0 or 1. If 0, compute the power column-wise, if 1, row-wise | {axis: 1} |

## **Examples**

### Apply a function to each element in a DataFrame

{% hint style="info" %}
Note that the specified function passed to **applyMap** will be called with each element in the DataFrame. If you need to apply a function across an axis, then use the [apply](/api-reference/dataframe/danfo.dataframe.apply.md) function.
{% endhint %}

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

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

let data = {
    short_name: ["NG", "GH", "EGY", "SA"],
    long_name: ["Nigeria", "Ghana", "Eqypt", "South Africa"]
}
let df = new dfd.DataFrame(data)

function lower(x) {
    return `${x}`.toLowerCase()
}

let df_new = df.apply_map(lower)
df_new.print()
```

{% endtab %}

{% tab title="Browser" %}

```
```

{% endtab %}
{% endtabs %}

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

```
╔════════════╤═══════════════════╤═══════════════════╗
║            │ short_name        │ long_name         ║
╟────────────┼───────────────────┼───────────────────╢
║ 0          │ ng                │ nigeria           ║
╟────────────┼───────────────────┼───────────────────╢
║ 1          │ gh                │ ghana             ║
╟────────────┼───────────────────┼───────────────────╢
║ 2          │ egy               │ eqypt             ║
╟────────────┼───────────────────┼───────────────────╢
║ 3          │ sa                │ south africa      ║
╚════════════╧═══════════════════╧═══════════════════╝
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://danfo.jsdata.org/api-reference/dataframe/dataframe.apply_map.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
