pandas.core.window.expanding.Expanding.apply¶
-
Expanding.apply(func, raw=False, args=(), kwargs={})[source]¶ The expanding function’s apply function.
- Parameters
- funcfunction
Must produce a single value from an ndarray input if
raw=Trueor a single value from a Series ifraw=False. Can also accept a Numba JIT function withengine='numba'specified.Changed in version 1.0.0.
- rawbool, default None
False: passes each row or column as a Series to the function.True: the passed function will receive ndarray objects instead. If you are just applying a NumPy reduction function this will achieve much better performance.
- enginestr, default ‘cython’
'cython': Runs rolling apply through C-extensions from cython.'numba': Runs rolling apply through JIT compiled code from numba. Only available whenrawis set toTrue.New in version 1.0.0.
- engine_kwargsdict, default None
For
'cython'engine, there are no acceptedengine_kwargsFor
'numba'engine, the engine can acceptnopython,nogilandparalleldictionary keys. The values must either beTrueorFalse. The defaultengine_kwargsfor the'numba'engine is{'nopython': True, 'nogil': False, 'parallel': False}and will be applied to both thefuncand theapplyrolling aggregation.New in version 1.0.0.
- argstuple, default None
Positional arguments to be passed into func.
- kwargsdict, default None
Keyword arguments to be passed into func.
- Returns
- Series or DataFrame
Return type is determined by the caller.
See also
Series.expandingSeries expanding.
DataFrame.expandingDataFrame expanding.
Notes
See Rolling Apply for extended documentation and performance considerations for the Numba engine.