📖 INDEX
LOADING ENGINE...
df.apply()
AI & DATA SCIENCE // df-apply
Apply a function along an axis of the DataFrame.
Syntax
res = df.apply(lambda x: x.max() - x.min(), axis=1)Examples
Example 01Basic Usage
res = df.apply(lambda x: x.max() - x.min(), axis=1)Best Practices
- Use vectorized operations over iterations (e.g.
iterrows()) for performance. - Always verify memory usage when loading large files.