w3resource

Pandas DataFrame: applymap() function

DataFrame - applymap() function

The applymap() function is used to apply a function to a Dataframe elementwise.

This method applies a function that accepts and returns a scalar to every element of a DataFrame.

Syntax:

DataFrame.applymap(self, func)

Parameters:

Name Description Type/Default Value Required / Optional
func Python function, returns a single value from a single value. callable Required

Returns:DataFrame
Transformed DataFrame.

Example:


Download the above Notebook from here.

Previous: DataFrame - apply() function
Next: DataFrame - pipe() function