Apply
In pandas, apply is a method that applies a callable across Series values or along a DataFrame axis and returns the results.
Pandas Workout: 200 exercises to make you a stronger data analyst
apply is a pandas method that applies a function to values or along an axis of a Series or DataFrame.
- How it is used
- Applies custom cleanup, calculation, or display functions across pandas values when built-in operations do not fit.
- How deep it goes
- Explains element-wise Series application through custom functions and returned values, without detailing pandas execution internals.
- Examples
- Uses Vehicle Make normalization, vowel counts in words, and formatted mean compensation by employment.
- What you can do after
- Apply it via pandas to transform Series values with a custom Python function and aggregate or inspect the results.
Read how Pandas Workout: 200 exercises to make you a stronger data analyst explains apply →
Build Python Web Apps with Streamlit
The pandas apply method applies a function across dataframe rows, columns, groups, or Series values.
- How it is used
- Builds daily metric data for a filtered dashboard time series.
- How deep it goes
- Explains grouped execution, lambda aggregation, group-label exclusion, and index restoration, but not broader performance trade-offs.
- Examples
- Demonstrates summing daily Sales from state, gender, and product records for a Plotly time series.
- What you can do after
- Builds grouped summary data and supplies it to a reusable time series chart.
Read how Build Python Web Apps with Streamlit explains apply →
Fast Python: High performance techniques for large datasets
- How it is used
- Uses apply as a pandas-based alternative to explicit row iteration for per-row computations.
- How deep it goes
- Explains row-wise callable execution and benchmarks it, then defers to vectorization for substantially better performance.
- Examples
- Calculates taxi tip-to-total fractions with a row-wise lambda and compares timings against itertuples and vectorized Series arithmetic.
- What you can do after
- Evaluate apply-based row computations against iteration and vectorization using measured runtime rather than assumed performance.
Read how Fast Python: High performance techniques for large datasets explains apply →
Related concepts
- data frameused by · A data frame is a two-dimensional tabular data structure with labeled rows and columns that can contain values of different types.
- vectorizationalternative to · Vectorization is representing data or computations in vector or array form so they can be processed collectively rather than as separate scalar values.
- comprehensionalternative to · A comprehension is a language construct that creates a collection by iterating over one or more sources, optionally filtering elements and transforming them.
- columnuses · A column is a vertical sequence or field in a tabular, grid, or matrix structure whose elements share a common position, attribute, or role.
- pandaspart of · pandas is an open-source Python library that provides labeled data structures and tools for manipulating and analyzing tabular and other structured data.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


