Compute the standard deviation along the specified axis, while ignoring NaNs. Returns the standard deviation, a measure of the spread of a distribution, of the non-NaN array elements. The standard deviation is computed for the flattened array by default, otherwise over the
(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue,
*, where=np._NoValue)
| 1777 | |
| 1778 | @array_function_dispatch(_nanstd_dispatcher) |
| 1779 | def nanstd(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue, |
| 1780 | *, where=np._NoValue): |
| 1781 | """ |
| 1782 | Compute the standard deviation along the specified axis, while |
| 1783 | ignoring NaNs. |
| 1784 | |
| 1785 | Returns the standard deviation, a measure of the spread of a |
| 1786 | distribution, of the non-NaN array elements. The standard deviation is |
| 1787 | computed for the flattened array by default, otherwise over the |
| 1788 | specified axis. |
| 1789 | |
| 1790 | For all-NaN slices or slices with zero degrees of freedom, NaN is |
| 1791 | returned and a `RuntimeWarning` is raised. |
| 1792 | |
| 1793 | .. versionadded:: 1.8.0 |
| 1794 | |
| 1795 | Parameters |
| 1796 | ---------- |
| 1797 | a : array_like |
| 1798 | Calculate the standard deviation of the non-NaN values. |
| 1799 | axis : {int, tuple of int, None}, optional |
| 1800 | Axis or axes along which the standard deviation is computed. The default is |
| 1801 | to compute the standard deviation of the flattened array. |
| 1802 | dtype : dtype, optional |
| 1803 | Type to use in computing the standard deviation. For arrays of |
| 1804 | integer type the default is float64, for arrays of float types it |
| 1805 | is the same as the array type. |
| 1806 | out : ndarray, optional |
| 1807 | Alternative output array in which to place the result. It must have |
| 1808 | the same shape as the expected output but the type (of the |
| 1809 | calculated values) will be cast if necessary. |
| 1810 | ddof : int, optional |
| 1811 | Means Delta Degrees of Freedom. The divisor used in calculations |
| 1812 | is ``N - ddof``, where ``N`` represents the number of non-NaN |
| 1813 | elements. By default `ddof` is zero. |
| 1814 | |
| 1815 | keepdims : bool, optional |
| 1816 | If this is set to True, the axes which are reduced are left |
| 1817 | in the result as dimensions with size one. With this option, |
| 1818 | the result will broadcast correctly against the original `a`. |
| 1819 | |
| 1820 | If this value is anything but the default it is passed through |
| 1821 | as-is to the relevant functions of the sub-classes. If these |
| 1822 | functions do not have a `keepdims` kwarg, a RuntimeError will |
| 1823 | be raised. |
| 1824 | where : array_like of bool, optional |
| 1825 | Elements to include in the standard deviation. |
| 1826 | See `~numpy.ufunc.reduce` for details. |
| 1827 | |
| 1828 | .. versionadded:: 1.22.0 |
| 1829 | |
| 1830 | Returns |
| 1831 | ------- |
| 1832 | standard_deviation : ndarray, see dtype parameter above. |
| 1833 | If `out` is None, return a new array containing the standard |
| 1834 | deviation, otherwise return a reference to the output array. If |
| 1835 | ddof is >= the number of non-NaN elements in a slice or the slice |
| 1836 | contains only NaNs, then the result for that slice is NaN. |