This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / lib / _nanfunctions_impl / _replace_nan

function

numpy.lib._nanfunctions_impl:_replace_nan

source: build-install/usr/lib/python3.14/site-packages/numpy/lib/_nanfunctions_impl.py :70

Signature

def   _replace_nan ( a val )

Summary

If a is of inexact type, make a copy of a, replace NaNs with the val value, and return the copy together with a boolean mask marking the locations where NaNs were present. If a is not of inexact type, do nothing and return a together with a mask of None.

Extended Summary

Note that scalars will end up as array scalars, which is important for using the result as the value of the out argument in some operations.

Parameters

a : array-like

Input array.

val : float

NaN values are set to val before doing the operation.

Returns

y : ndarray

If a is of inexact type, return a copy of a with the NaNs replaced by the fill value, otherwise return a.

: mask: {bool, None}

If a is of inexact type, return a boolean mask marking locations of NaNs, otherwise return None.

Aliases

  • numpy.lib._nanfunctions_impl._replace_nan