diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2009-03-08 18:21:06 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2009-03-08 18:21:06 +0000 |
commit | 090ce2ad88f775ad0bdc009061457c1ff8b40b74 (patch) | |
tree | 5695f25b1574d98fb3621b5289cccbc48fd210d8 /numpy/core | |
parent | bb4c141e31484ecc2af21a26cf11d9293c3d7284 (diff) | |
download | numpy-090ce2ad88f775ad0bdc009061457c1ff8b40b74.tar.gz |
Merge reviewed docstrings from editor.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/arrayprint.py | 11 | ||||
-rw-r--r-- | numpy/core/code_generators/ufunc_docstrings.py | 58 | ||||
-rw-r--r-- | numpy/core/fromnumeric.py | 21 |
3 files changed, 28 insertions, 62 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index 98df924e7..a3edb64d4 100644 --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -245,7 +245,8 @@ def array2string(a, max_line_width = None, precision = None, Floating point precision. Default is the current printing precision (usually 8), which can be altered using `set_printoptions`. suppress_small : bool, optional - Represent very small numbers as zero. + Represent very small numbers as zero. A number is "very small" if it + is smaller than the current printing precision. separator : string, optional Inserted between elements. prefix : string, optional @@ -256,7 +257,13 @@ def array2string(a, max_line_width = None, precision = None, The length of the prefix string is used to align the output correctly. style : function, optional - Callable. + A function that accepts an ndarray and returns a string. Used only + when the shape of `a` is equal to (). + + Returns + ------- + array_str : str + String representation of the array. See Also -------- diff --git a/numpy/core/code_generators/ufunc_docstrings.py b/numpy/core/code_generators/ufunc_docstrings.py index 08d544bc5..636b2978f 100644 --- a/numpy/core/code_generators/ufunc_docstrings.py +++ b/numpy/core/code_generators/ufunc_docstrings.py @@ -790,36 +790,11 @@ add_newdoc('numpy.core.umath', 'cosh', add_newdoc('numpy.core.umath', 'degrees', """ - Convert angles from radians to degrees. This is the same - function as rad2deg but the latter is preferred because of - the more descriptive name. - - Parameters - ---------- - x : array_like - Angle in radians. - - Returns - ------- - y : ndarray - The corresponding angle in degrees. - + Convert angles from radians to degrees. See Also -------- - rad2deg : Convert angles from radians to degrees. - deg2rad : Convert angles from degrees to radians. - radians : Convert angles from degrees to radians. - unwrap : Remove large jumps in angle by wrapping. - - Notes - ----- - degrees(x) is ``180 * x / pi``. - - Examples - -------- - >>> np.degrees(np.pi/2) - 90.0 + rad2deg : equivalent function; see for documentation. """) @@ -1203,7 +1178,7 @@ add_newdoc('numpy.core.umath', 'greater', See Also -------- - greater_equal + greater_equal, less, less_equal, equal, not_equal Examples -------- @@ -2244,34 +2219,11 @@ add_newdoc('numpy.core.umath', 'power', add_newdoc('numpy.core.umath', 'radians', """ - Convert angles from degrees to radians. This function is - the same as deg2rad, which is more descriptive.. - - Parameters - ---------- - x : array_like - Angles in degrees. - - Returns - ------- - y : ndarray - The corresponding angle in radians. + Convert angles from degrees to radians. See Also -------- - deg2rad : Convert angles from degrees to radians. - rad2deg : Convert angles from radians to degrees. - degrees : Convert angles from radians to degrees. - unwrap : Remove large jumps in angle by wrapping. - - Notes - ----- - ``radians(x)`` is ``x * pi / 180``. - - Examples - -------- - >>> np.radians(180) - 3.1415926535897931 + deg2rad : equivalent function; see for documentation. """) diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index ed66a1ccf..cd9762d3c 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -819,7 +819,6 @@ def diagonal(a, offset=0, axis1=0, axis2=1): >>> a array([[[0, 1], [2, 3]], - <BLANKLINE> [[4, 5], [6, 7]]]) >>> a.diagonal(0,-2,-1) @@ -2132,9 +2131,10 @@ def var(a, axis=None, dtype=None, out=None, ddof=0): Alternative output array in which to place the result. It must have the same shape as the expected output but the type is cast if necessary. - ddof : positive int,optional + ddof : int, optional "Delta Degrees of Freedom": the divisor used in calculation is - N - ddof. + ``N - ddof``, where ``N`` represents the number of elements. By + default `ddof` is zero. Returns ------- @@ -2150,10 +2150,17 @@ def var(a, axis=None, dtype=None, out=None, ddof=0): Notes ----- The variance is the average of the squared deviations from the mean, - i.e., var = mean(abs(x - x.mean())**2). The computed variance is biased, - i.e., the mean is computed by dividing by the number of elements, N, - rather than by N-1. Note that for complex numbers the absolute value is - taken before squaring, so that the result is always real and nonnegative. + i.e., ``var = mean(abs(x - x.mean())**2)``. + + The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. + If, however, `ddof` is specified, the divisor ``N - ddof`` is used + instead. In standard statistical practice, ``ddof=1`` provides an + unbiased estimator of the variance of the infinite population. ``ddof=0`` + provides a maximum likelihood estimate of the variance for normally + distributed variables. + + Note that for complex numbers, the absolute value is taken before + squaring, so that the result is always real and nonnegative. Examples -------- |