nz
Syntax Format
nz(value[, default])
Overview
The nz function provides the specified substitute value in case the given value is nan or nil.
- If the value is
series, then the function returns aserieswith the all nan values in the input series replaced with the default value. Otherwise, returns value if value is not nan or nil. Otherwise, returns default. - If default is
series, the function will use the current value of default if needed.
Parameters
| Parameter | Type | Purpose |
|---|---|---|
| value | series or numeric | Input value |
| value | - | Optional default value. 0 if the default is not set. |
Returns: series or numeric.
Example
value_1 = 5 / 0 -- the result is nan
value_2 = nz(value_1) -- the returned result will be 0 as the default value was not set