Apply vs Map vs ApplyMap

One of the most fundamental things a person trying to learn Pandas in Python must grasp is the differences between apply vs map vs applymap. Although the differences might seem confusing at first, using some real-world examples helps cement the differences.


When data cleaning in Pandas, map() will only function on the rows of a given series

For example:

messages['tokenizer'] = messages['tokenizer'].map(lambda x: tokenizer.tokenize(x))

As you can see, I am only changing the values of one series in my data frame, which is why map worked in this instance.


The apply() function is interesting because it can also work exactly the same as above.

messages['tokenizer'] = messages['tokenizer'].apply(lambda x: tokenizer.tokenize(x))

But, it’s not just limited to working on a single series.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store