dh_null_to_nan

The dh_null_to_nan method converts Deephaven primitive null values in the given numpy array to numpy.nan. No conversion is performed on non-primitive values.

Note

dh_null_to_nan never modifies the input array. For an array of a primitive type, it returns a new array.

Syntax

Parameters

ParameterTypeDescription
np_arraynumpy.ndarray

The numpy array to convert.

type_promotion optionalbool

When True, integer, boolean, or character arrays are converted to new np.float64 arrays and Deephaven null values in them are converted to np.nan. Numpy arrays of float or double types are not affected by this flag, and Deephaven nulls will always be converted to np.nan.

When False, integer, boolean, or character arrays will cause an exception to be raised. Default is False.

Returns

A numpy.ndarray.

Examples

In the example below, we create a simple Deephaven table with null values. We then convert the table to a numpy array and use dh_null_to_nan to convert the Deephaven null values to numpy.nan.