(x, out=None)
return x
Equivalent of np.isnan that supports sparse and dense matrices.
Equivalent of np.isnan that supports sparse and dense matrices.
Equivalent of np . isnan that supports sparse and dense matrices .
def isnan(x, out=None):
    """ Equivalent of np.isnan that supports sparse and dense matrices. """
    if not sp.issparse(x):
        return np.isnan(x, out=out)

    if out is None:
        x = x.copy()
    elif out is not x:
        raise ValueError(
            "The `out` parameter can only be set `x` when using sparse matrices"
        )

    np.isnan(x.data, out=x.data)
    _eliminate_zeros(x)
    return x
def isnan ( x , out = None ) : if not sp . issparse ( x ) : return np . isnan ( x , out = out ) if out is None : x = x . copy ( ) elif out is not x : raise ValueError ( "The `out` parameter can only be set `x` when using sparse matrices" ) np . isnan ( x . data , out = x . data ) _eliminate_zeros ( x ) return x