AI engineering glossary · NumPy pandas visualization

What is apply?

apply: A pandas method that calls a Python function on each column, each row, or each group of a table. It is flexible but usually much slower than built-in vectorised operations because the function runs one item at a time in Python, so use it only when no vectorised option exists.

Level: intermediateTopic: NumPy pandas visualization

apply: an example

df['tier'] = df['spend'].apply(lambda x: 'high' if x > 5000 else 'low') labels customers by spend.

Related terms

More NumPy pandas visualization terms

Where you learn it

apply is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.