Skip to content

Commit

Permalink
Merge pull request numpy#17250 from albertvillanova/fix-docstring
Browse files Browse the repository at this point in the history
DOC: Fix docstring cross-referencing
  • Loading branch information
charris authored Sep 10, 2020
2 parents be92e00 + 31fbcf5 commit 7e9d603
Show file tree
Hide file tree
Showing 13 changed files with 183 additions and 83 deletions.
32 changes: 16 additions & 16 deletions numpy/core/fromnumeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def repeat(a, repeats, axis=None):
--------
tile : Tile an array.
unique : Find the unique elements of an array.
Examples
--------
>>> np.repeat(3, 4)
Expand Down Expand Up @@ -2007,8 +2007,8 @@ def compress(condition, a, axis=None, out=None):
--------
take, choose, diag, diagonal, select
ndarray.compress : Equivalent method in ndarray
np.extract: Equivalent method when working on 1-D arrays
ufuncs-output-type
extract: Equivalent method when working on 1-D arrays
:ref:`ufuncs-output-type`
Examples
--------
Expand Down Expand Up @@ -2082,7 +2082,7 @@ def clip(a, a_min, a_max, out=None, **kwargs):
See Also
--------
ufuncs-output-type
:ref:`ufuncs-output-type`
Examples
--------
Expand Down Expand Up @@ -2278,7 +2278,7 @@ def any(a, axis=None, out=None, keepdims=np._NoValue):
the same shape as the expected output and its type is preserved
(e.g., if it is of type float, then it will remain so, returning
1.0 for True and 0.0 for False, regardless of the type of `a`).
See `ufuncs-output-type` for more details.
See :ref:`ufuncs-output-type` for more details.
keepdims : bool, optional
If this is set to True, the axes which are reduced are left
Expand Down Expand Up @@ -2363,7 +2363,7 @@ def all(a, axis=None, out=None, keepdims=np._NoValue):
Alternate output array in which to place the result.
It must have the same shape as the expected output and its
type is preserved (e.g., if ``dtype(out)`` is float, the result
will consist of 0.0's and 1.0's). See `ufuncs-output-type` for more
will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more
details.
keepdims : bool, optional
Expand Down Expand Up @@ -2442,7 +2442,7 @@ def cumsum(a, axis=None, dtype=None, out=None):
out : ndarray, optional
Alternative output array in which to place the result. It must
have the same shape and buffer length as the expected output
but the type will be cast if necessary. See `ufuncs-output-type` for
but the type will be cast if necessary. See :ref:`ufuncs-output-type` for
more details.
Returns
Expand Down Expand Up @@ -2613,7 +2613,7 @@ def amax(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
out : ndarray, optional
Alternative output array in which to place the result. Must
be of the same shape and buffer length as the expected output.
See `ufuncs-output-type` for more details.
See :ref:`ufuncs-output-type` for more details.
keepdims : bool, optional
If this is set to True, the axes which are reduced are left
Expand Down Expand Up @@ -2738,7 +2738,7 @@ def amin(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
out : ndarray, optional
Alternative output array in which to place the result. Must
be of the same shape and buffer length as the expected output.
See `ufuncs-output-type` for more details.
See :ref:`ufuncs-output-type` for more details.
keepdims : bool, optional
If this is set to True, the axes which are reduced are left
Expand Down Expand Up @@ -2948,7 +2948,7 @@ def prod(a, axis=None, dtype=None, out=None, keepdims=np._NoValue,
See Also
--------
ndarray.prod : equivalent method
ufuncs-output-type
:ref:`ufuncs-output-type`
Notes
-----
Expand Down Expand Up @@ -3044,7 +3044,7 @@ def cumprod(a, axis=None, dtype=None, out=None):
See Also
--------
ufuncs-output-type
:ref:`ufuncs-output-type`
Notes
-----
Expand Down Expand Up @@ -3190,7 +3190,7 @@ def around(a, decimals=0, out=None):
out : ndarray, optional
Alternative output array in which to place the result. It must have
the same shape as the expected output, but the type of the output
values will be cast if necessary. See `ufuncs-output-type` for more
values will be cast if necessary. See :ref:`ufuncs-output-type` for more
details.
Returns
Expand Down Expand Up @@ -3305,7 +3305,7 @@ def mean(a, axis=None, dtype=None, out=None, keepdims=np._NoValue):
Alternate output array in which to place the result. The default
is ``None``; if provided, it must have the same shape as the
expected output, but the type will be cast if necessary.
See `ufuncs-output-type` for more details.
See :ref:`ufuncs-output-type` for more details.
keepdims : bool, optional
If this is set to True, the axes which are reduced are left
Expand Down Expand Up @@ -3440,12 +3440,12 @@ def std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue):
See Also
--------
var, mean, nanmean, nanstd, nanvar
ufuncs-output-type
:ref:`ufuncs-output-type`
Notes
-----
The standard deviation is the square root of the average of the squared
deviations from the mean, i.e., ``std = sqrt(mean(x))``, where
deviations from the mean, i.e., ``std = sqrt(mean(x))``, where
``x = abs(a - a.mean())**2``.
The average squared deviation is typically calculated as ``x.sum() / N``,
Expand Down Expand Up @@ -3566,7 +3566,7 @@ def var(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue):
See Also
--------
std, mean, nanmean, nanstd, nanvar
ufuncs-output-type
:ref:`ufuncs-output-type`
Notes
-----
Expand Down
10 changes: 5 additions & 5 deletions numpy/core/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ class recarray(ndarray):
See Also
--------
rec.fromrecords : Construct a record array from data.
core.records.fromrecords : Construct a record array from data.
record : fundamental data-type for `recarray`.
format_parser : determine a data-type from formats, names, titles.
Expand Down Expand Up @@ -630,7 +630,7 @@ def fromarrays(arrayList, dtype=None, shape=None, formats=None,
>>> x1[1]=34
>>> r.a
array([1, 2, 3, 4])
>>> x1 = np.array([1, 2, 3, 4])
>>> x2 = np.array(['a', 'dd', 'xyz', '12'])
>>> x3 = np.array([1.1, 2, 3,4])
Expand Down Expand Up @@ -911,7 +911,7 @@ def fromfile(fd, dtype=None, shape=None, offset=0, formats=None,
shape = (shape,)

if hasattr(fd, 'readinto'):
# GH issue 2504. fd supports io.RawIOBase or io.BufferedIOBase interface.
# GH issue 2504. fd supports io.RawIOBase or io.BufferedIOBase interface.
# Example of fd: gzip, BytesIO, BufferedReader
# file already opened
ctx = contextlib_nullcontext(fd)
Expand Down Expand Up @@ -958,7 +958,7 @@ def array(obj, dtype=None, shape=None, offset=0, strides=None, formats=None,
"""
Construct a record array from a wide-variety of objects.
A general-purpose record array constructor that dispatches to the
A general-purpose record array constructor that dispatches to the
appropriate `recarray` creation function based on the inputs (see Notes).
Parameters
Expand Down Expand Up @@ -996,7 +996,7 @@ def array(obj, dtype=None, shape=None, offset=0, strides=None, formats=None,
`obj` is a string, then call the `fromstring` constructor. If `obj` is a
list or a tuple, then if the first object is an `~numpy.ndarray`, call
`fromarrays`, otherwise call `fromrecords`. If `obj` is a
`~numpy.recarray`, then make a copy of the data in the recarray
`~numpy.recarray`, then make a copy of the data in the recarray
(if ``copy=True``) and use the new formats, names, and titles. If `obj`
is a file, then call `fromfile`. Finally, if obj is an `ndarray`, then
return ``obj.view(recarray)``, making a copy of the data if ``copy=True``.
Expand Down
2 changes: 1 addition & 1 deletion numpy/distutils/ccompiler_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2186,7 +2186,7 @@ def try_dispatch(self, sources, src_dir=None, **kwargs):
See Also
--------
parse_targets() :
parse_targets :
Parsing the configuration statements of dispatch-able sources.
"""
to_compile = {}
Expand Down
4 changes: 0 additions & 4 deletions numpy/doc/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ def add_newdoc(module, name, doc):
"""
A convenient alias for None, useful for indexing arrays.
See Also
--------
`numpy.doc.indexing`
Examples
--------
>>> newaxis is None
Expand Down
7 changes: 3 additions & 4 deletions numpy/lib/function_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4229,10 +4229,9 @@ def meshgrid(*xi, copy=True, sparse=False, indexing='xy'):
See Also
--------
index_tricks.mgrid : Construct a multi-dimensional "meshgrid"
using indexing notation.
index_tricks.ogrid : Construct an open multi-dimensional "meshgrid"
using indexing notation.
mgrid : Construct a multi-dimensional "meshgrid" using indexing notation.
ogrid : Construct an open multi-dimensional "meshgrid" using indexing
notation.
Examples
--------
Expand Down
18 changes: 9 additions & 9 deletions numpy/lib/nanfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def nanmin(a, axis=None, out=None, keepdims=np._NoValue):
Alternate output array in which to place the result. The default
is ``None``; if provided, it must have the same shape as the
expected output, but the type will be cast if necessary. See
`ufuncs-output-type` for more details.
:ref:`ufuncs-output-type` for more details.
.. versionadded:: 1.8.0
keepdims : bool, optional
Expand Down Expand Up @@ -359,7 +359,7 @@ def nanmax(a, axis=None, out=None, keepdims=np._NoValue):
Alternate output array in which to place the result. The default
is ``None``; if provided, it must have the same shape as the
expected output, but the type will be cast if necessary. See
`ufuncs-output-type` for more details.
:ref:`ufuncs-output-type` for more details.
.. versionadded:: 1.8.0
keepdims : bool, optional
Expand Down Expand Up @@ -584,7 +584,7 @@ def nansum(a, axis=None, dtype=None, out=None, keepdims=np._NoValue):
Alternate output array in which to place the result. The default
is ``None``. If provided, it must have the same shape as the
expected output, but the type will be cast if necessary. See
`ufuncs-output-type` for more details. The casting of NaN to integer
:ref:`ufuncs-output-type` for more details. The casting of NaN to integer
can yield unexpected results.
.. versionadded:: 1.8.0
Expand Down Expand Up @@ -681,7 +681,7 @@ def nanprod(a, axis=None, dtype=None, out=None, keepdims=np._NoValue):
Alternate output array in which to place the result. The default
is ``None``. If provided, it must have the same shape as the
expected output, but the type will be cast if necessary. See
`ufuncs-output-type` for more details. The casting of NaN to integer
:ref:`ufuncs-output-type` for more details. The casting of NaN to integer
can yield unexpected results.
keepdims : bool, optional
If True, the axes which are reduced are left in the result as
Expand Down Expand Up @@ -749,7 +749,7 @@ def nancumsum(a, axis=None, dtype=None, out=None):
out : ndarray, optional
Alternative output array in which to place the result. It must
have the same shape and buffer length as the expected output
but the type will be cast if necessary. See `ufuncs-output-type` for
but the type will be cast if necessary. See :ref:`ufuncs-output-type` for
more details.
Returns
Expand Down Expand Up @@ -888,7 +888,7 @@ def nanmean(a, axis=None, dtype=None, out=None, keepdims=np._NoValue):
Alternate output array in which to place the result. The default
is ``None``; if provided, it must have the same shape as the
expected output, but the type will be cast if necessary. See
`ufuncs-output-type` for more details.
:ref:`ufuncs-output-type` for more details.
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,
Expand Down Expand Up @@ -1256,7 +1256,7 @@ def nanquantile(a, q, axis=None, out=None, overwrite_input=False,
Compute the qth quantile of the data along the specified axis,
while ignoring nan values.
Returns the qth quantile(s) of the array elements.
.. versionadded:: 1.15.0
Parameters
Expand Down Expand Up @@ -1472,7 +1472,7 @@ def nanvar(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue):
mean : Average
var : Variance while not ignoring NaNs
nanstd, nanmean
ufuncs-output-type
:ref:`ufuncs-output-type`
Notes
-----
Expand Down Expand Up @@ -1624,7 +1624,7 @@ def nanstd(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue):
--------
var, mean, std
nanvar, nanmean
ufuncs-output-type
:ref:`ufuncs-output-type`
Notes
-----
Expand Down
16 changes: 16 additions & 0 deletions numpy/lib/scimath.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@
Similarly, `sqrt`, other base logarithms, `power` and trig functions are
correctly handled. See their respective docstrings for specific examples.
Functions
---------
.. autosummary::
:toctree: generated/
sqrt
log
log2
logn
log10
power
arccos
arcsin
arctanh
"""
import numpy.core.numeric as nx
import numpy.core.numerictypes as nt
Expand Down
Loading

0 comments on commit 7e9d603

Please sign in to comment.