Skip to main content

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 a series with 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

ParameterTypePurpose
valueseries or numericInput 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