numpy.nanstd() function Python (original) (raw)
Last Updated : 11 Jun, 2020
numpy.nanstd()
function compute the standard deviation along the specified axis, while ignoring NaNs.
Syntax : numpy.nanstd(arr, axis = None, dtype = None, out = None, ddof = 0, keepdims)
Parameters :
arr : [array_like] Calculate the standard deviation of the non-NaN values.
axis : [{int, tuple of int, None}, optional] Axis along which the standard deviation is computed.
dtype : [dtype, optional] Type to use in computing the standard deviation. For arrays of integer type, the default is float64, for arrays of float types it is the same as the array type.
out : [ndarray, optional] Alternative output array in which to place the result.
ddof : [int, optional] ddof means Delta Degrees of Freedom. The divisor used in calculations is N – ddof, where N represents the number of non-NaN elements. By default, ddof is zero.
keepdims : [bool, optional] If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original arr.Return : [standard_deviation] If out is None, return a new array containing the standard deviation, otherwise return a reference to the output array.
Code #1 :
import
numpy as geek
arr
=
geek.array([[
1
,
2
], [geek.nan,
4
]])
gfg
=
geek.nanstd(arr)
print
(gfg)
Output :
1.247219128924647
Code #2 :
import
numpy as geek
arr
=
geek.array([[
1
,
2
], [geek.nan,
4
]])
gfg
=
geek.nanstd(arr, axis
=
0
)
print
(gfg)
Output :
[0. 1.]
Similar Reads
- Python | Numpy nanmedian() function numpy.nanmedian() function can be used to calculate the median of array ignoring the NaN value. If array have NaN value and we can find out the median without effect of NaN value. Let's see different type of examples about numpy.nanmedian() method. Syntax: numpy.nanmedian(a, axis=None, out=None, ove 2 min read
- Python | numpy.nanmean() function numpy.nanmean() function can be used to calculate the mean of array ignoring the NaN value. If array have NaN value and we can find out the mean without effect of NaN value. Syntax: numpy.nanmean(a, axis=None, dtype=None, out=None, keepdims=))Parameters: a: [arr_like] input array axis: we can use ax 2 min read
- numpy.i0() function | Python numpy.i0() function is the modified Bessel function of the first kind, order 0. it's usually denoted by I0. Syntax : numpy.i0(x) Parameters : x : [array_like, dtype float or complex] Argument of the Bessel function. Return : [ndarray, shape = x.shape, dtype = x.dtype] The modified Bessel function ev 1 min read
- numpy.iinfo() function – Python numpy.iinfo() function shows machine limits for integer types. Syntax : numpy.iinfo(dtype) Parameters : dtype : [integer type, dtype, or instance] The kind of integer data type to get information about. Return : Machine limits for integer types. Code #1 : # Python program explaining # numpy.iinfo() 1 min read
- numpy.mintypecode() function – Python numpy.mintypecode() function return the character for the minimum-size type to which given types can be safely cast. Syntax : numpy.mintypecode(typechars, typeset = 'GDFgdf', default = 'd') Parameters : typechars : [list of str or array_like] If a list of strings, each string should represent a dtyp 1 min read
- numpy.pad() function in Python numpy.pad() function is used to pad the Numpy arrays. Sometimes there is a need to perform padding in Numpy arrays, then numPy.pad() function is used. The function returns the padded array of rank equal to the given array and the shape will increase according to pad_width. Syntax: numpy.pad(array, p 2 min read
- numpy.mask_indices() function | Python numpy.mask_indices() function return the indices to access (n, n) arrays, given a masking function. Syntax : numpy.mask_indices(n, mask_func, k = 0) Parameters : n : [int] The returned indices will be valid to access arrays of shape (n, n). mask_func : [callable] A function whose call signature is s 1 min read
- numpy.nansum() in Python numpy.nansum()function is used when we want to compute the sum of array elements over a given axis treating Not a Numbers (NaNs) as zero. Syntax : numpy.nansum(arr, axis=None, dtype=None, out=None, keepdims='no value') Parameters : arr : [array_like] Array containing numbers whose sum is desired. If 3 min read
- numpy.nanprod() in Python numpy.nanprod() function is used when we want to compute the product of array elements over a given axis treating NaNs as ones. One is returned for slices that are all-NaN or empty. Syntax : numpy.nanprod(arr, axis=None, dtype=None, out=None, keepdims='class numpy._globals._NoValue'). Parameters : a 2 min read
- numpy.isnan() in Python The numpy.isnan() function tests element-wise whether it is NaN or not and returns the result as a boolean array. Syntax : numpy.isnan(array [, out]) Parameters : array : [array_like]Input array or object whose elements, we need to test for infinity out : [ndarray, optional]Output array placed with 2 min read