pandas.Series.transform

pandas 3.1.1 · Series and accessors · method

Apply an operation and retain compatibility with the input shape. GroupBy aligns the result with the original rows.

Call syntax

Series.transform(func, axis=0, *args, **kwargs)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
func Required
Positional or keyword
function, str, list-like or dict-like

Supply a supported operation name or a callable, depending on this API.

axis Optional
Positional or keyword
Default 0
{0 or 'index'}

Choose which axis the operation acts on. The accepted axis labels depend on the receiver.

*args Optional
Additional positional arguments
**kwargs Optional
Additional keyword arguments

Returns

Series