Difference between apply(), map(), and applymap()?
1 min readMar 28, 2026
🔹 map()
- Works only on a Pandas Series
- Applies a function to each individual value (element-wise)
- Mostly used for simple transformations or value mapping
Press enter or click to view image in full size![Difference between apply(), map(), and applymap()?]()
👉 Example:
df["Gender"] = df["Gender"].map({"M": "Male", "F": "Female"})✔ Best for: replacing or transforming values in a single column
🔹 apply()
- Works on both Series and DataFrame
- Can apply a function:
- Element-wise (on Series)
- Row-wise or column-wise (on DataFrame)
Get Byot Tech’s stories in your inbox
Join Medium for free to get updates from this writer.
👉 Example (Series):
df["Salary"].apply(lambda x: x * 1.1)👉 Example (DataFrame row-wise):
df.apply(lambda row: row["A"] + row["B"], axis=1)✔ Best for: custom logic or more complex operations
🔹 applymap()
- Works only on DataFrame
- Applies a function to every single cell (element-wise)
👉 Example:
df.applymap(lambda x: x * 2)✔ Best for: transforming entire DataFrame values
🔹 Key Idea to Remember
map()→ single column, simple value mappingapply()→ flexible, row/column logicapplymap()→ every cell in DataFrame








