Tutorials References Exercises Sign Up Menu
Create Website Get Certified Pro

Pandas DataFrame applymap() Method

❮ DataFrame Reference


Apply a function to the DataFrame that will upper case the values:

import pandas as pd

def make_big(x):
  return x.upper()

data = {
  "name": ["Sally","Mary","John"],
  "city": ["London", "Tokyo", "Madrid"]

df = pd.DataFrame(data)

newdf = df.applymap(make_big)

Try it Yourself »

Definition and Usage

The applymap() method allows you to apply one or more functions to the DataFrame object.


dataframe.applymap(func, args, kwargs)


The na_action parameter is a keyword argument.

Parameter Value Description
func   Required. A function to apply to the DataFrame.
na_action ignore Optional, Whether to ignore NULL values or not. Default is to not ignore them

Return Value

A DataFrame object, with the changes.

This function does NOT make changes to the original DataFrame object.

❮ DataFrame Reference