pandas.Series.apply
pandas 3.1.1 · Series and accessors · method
Run a callable over the units of the object, such as rows, columns, groups, or windows. The receiver controls which units it passes to the callable.
Call syntax
Series.apply(func, args=(), *, by_row='compat', **kwargs)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
func |
Required Positional or keyword |
function Supply a supported operation name or a callable, depending on this API. |
args |
Optional Positional or keyword Default () |
tuple |
by_row |
Optional Keyword only Default 'compat' |
False or "compat" |
**kwargs |
Optional Additional keyword arguments |
Returns
Series or DataFrame