Skip to content

Commit 7e9d603

Browse files
authored
Merge pull request numpy#17250 from albertvillanova/fix-docstring
DOC: Fix docstring cross-referencing
2 parents be92e00 + 31fbcf5 commit 7e9d603

File tree

13 files changed

+183
-83
lines changed

13 files changed

+183
-83
lines changed

numpy/core/fromnumeric.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def repeat(a, repeats, axis=None):
460460
--------
461461
tile : Tile an array.
462462
unique : Find the unique elements of an array.
463-
463+
464464
Examples
465465
--------
466466
>>> np.repeat(3, 4)
@@ -2007,8 +2007,8 @@ def compress(condition, a, axis=None, out=None):
20072007
--------
20082008
take, choose, diag, diagonal, select
20092009
ndarray.compress : Equivalent method in ndarray
2010-
np.extract: Equivalent method when working on 1-D arrays
2011-
ufuncs-output-type
2010+
extract: Equivalent method when working on 1-D arrays
2011+
:ref:`ufuncs-output-type`
20122012
20132013
Examples
20142014
--------
@@ -2082,7 +2082,7 @@ def clip(a, a_min, a_max, out=None, **kwargs):
20822082
20832083
See Also
20842084
--------
2085-
ufuncs-output-type
2085+
:ref:`ufuncs-output-type`
20862086
20872087
Examples
20882088
--------
@@ -2278,7 +2278,7 @@ def any(a, axis=None, out=None, keepdims=np._NoValue):
22782278
the same shape as the expected output and its type is preserved
22792279
(e.g., if it is of type float, then it will remain so, returning
22802280
1.0 for True and 0.0 for False, regardless of the type of `a`).
2281-
See `ufuncs-output-type` for more details.
2281+
See :ref:`ufuncs-output-type` for more details.
22822282
22832283
keepdims : bool, optional
22842284
If this is set to True, the axes which are reduced are left
@@ -2363,7 +2363,7 @@ def all(a, axis=None, out=None, keepdims=np._NoValue):
23632363
Alternate output array in which to place the result.
23642364
It must have the same shape as the expected output and its
23652365
type is preserved (e.g., if ``dtype(out)`` is float, the result
2366-
will consist of 0.0's and 1.0's). See `ufuncs-output-type` for more
2366+
will consist of 0.0's and 1.0's). See :ref:`ufuncs-output-type` for more
23672367
details.
23682368
23692369
keepdims : bool, optional
@@ -2442,7 +2442,7 @@ def cumsum(a, axis=None, dtype=None, out=None):
24422442
out : ndarray, optional
24432443
Alternative output array in which to place the result. It must
24442444
have the same shape and buffer length as the expected output
2445-
but the type will be cast if necessary. See `ufuncs-output-type` for
2445+
but the type will be cast if necessary. See :ref:`ufuncs-output-type` for
24462446
more details.
24472447
24482448
Returns
@@ -2613,7 +2613,7 @@ def amax(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
26132613
out : ndarray, optional
26142614
Alternative output array in which to place the result. Must
26152615
be of the same shape and buffer length as the expected output.
2616-
See `ufuncs-output-type` for more details.
2616+
See :ref:`ufuncs-output-type` for more details.
26172617
26182618
keepdims : bool, optional
26192619
If this is set to True, the axes which are reduced are left
@@ -2738,7 +2738,7 @@ def amin(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
27382738
out : ndarray, optional
27392739
Alternative output array in which to place the result. Must
27402740
be of the same shape and buffer length as the expected output.
2741-
See `ufuncs-output-type` for more details.
2741+
See :ref:`ufuncs-output-type` for more details.
27422742
27432743
keepdims : bool, optional
27442744
If this is set to True, the axes which are reduced are left
@@ -2948,7 +2948,7 @@ def prod(a, axis=None, dtype=None, out=None, keepdims=np._NoValue,
29482948
See Also
29492949
--------
29502950
ndarray.prod : equivalent method
2951-
ufuncs-output-type
2951+
:ref:`ufuncs-output-type`
29522952
29532953
Notes
29542954
-----
@@ -3044,7 +3044,7 @@ def cumprod(a, axis=None, dtype=None, out=None):
30443044
30453045
See Also
30463046
--------
3047-
ufuncs-output-type
3047+
:ref:`ufuncs-output-type`
30483048
30493049
Notes
30503050
-----
@@ -3190,7 +3190,7 @@ def around(a, decimals=0, out=None):
31903190
out : ndarray, optional
31913191
Alternative output array in which to place the result. It must have
31923192
the same shape as the expected output, but the type of the output
3193-
values will be cast if necessary. See `ufuncs-output-type` for more
3193+
values will be cast if necessary. See :ref:`ufuncs-output-type` for more
31943194
details.
31953195
31963196
Returns
@@ -3305,7 +3305,7 @@ def mean(a, axis=None, dtype=None, out=None, keepdims=np._NoValue):
33053305
Alternate output array in which to place the result. The default
33063306
is ``None``; if provided, it must have the same shape as the
33073307
expected output, but the type will be cast if necessary.
3308-
See `ufuncs-output-type` for more details.
3308+
See :ref:`ufuncs-output-type` for more details.
33093309
33103310
keepdims : bool, optional
33113311
If this is set to True, the axes which are reduced are left
@@ -3440,12 +3440,12 @@ def std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue):
34403440
See Also
34413441
--------
34423442
var, mean, nanmean, nanstd, nanvar
3443-
ufuncs-output-type
3443+
:ref:`ufuncs-output-type`
34443444
34453445
Notes
34463446
-----
34473447
The standard deviation is the square root of the average of the squared
3448-
deviations from the mean, i.e., ``std = sqrt(mean(x))``, where
3448+
deviations from the mean, i.e., ``std = sqrt(mean(x))``, where
34493449
``x = abs(a - a.mean())**2``.
34503450
34513451
The average squared deviation is typically calculated as ``x.sum() / N``,
@@ -3566,7 +3566,7 @@ def var(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue):
35663566
See Also
35673567
--------
35683568
std, mean, nanmean, nanstd, nanvar
3569-
ufuncs-output-type
3569+
:ref:`ufuncs-output-type`
35703570
35713571
Notes
35723572
-----

numpy/core/records.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ class recarray(ndarray):
374374
375375
See Also
376376
--------
377-
rec.fromrecords : Construct a record array from data.
377+
core.records.fromrecords : Construct a record array from data.
378378
record : fundamental data-type for `recarray`.
379379
format_parser : determine a data-type from formats, names, titles.
380380
@@ -630,7 +630,7 @@ def fromarrays(arrayList, dtype=None, shape=None, formats=None,
630630
>>> x1[1]=34
631631
>>> r.a
632632
array([1, 2, 3, 4])
633-
633+
634634
>>> x1 = np.array([1, 2, 3, 4])
635635
>>> x2 = np.array(['a', 'dd', 'xyz', '12'])
636636
>>> x3 = np.array([1.1, 2, 3,4])
@@ -911,7 +911,7 @@ def fromfile(fd, dtype=None, shape=None, offset=0, formats=None,
911911
shape = (shape,)
912912

913913
if hasattr(fd, 'readinto'):
914-
# GH issue 2504. fd supports io.RawIOBase or io.BufferedIOBase interface.
914+
# GH issue 2504. fd supports io.RawIOBase or io.BufferedIOBase interface.
915915
# Example of fd: gzip, BytesIO, BufferedReader
916916
# file already opened
917917
ctx = contextlib_nullcontext(fd)
@@ -958,7 +958,7 @@ def array(obj, dtype=None, shape=None, offset=0, strides=None, formats=None,
958958
"""
959959
Construct a record array from a wide-variety of objects.
960960
961-
A general-purpose record array constructor that dispatches to the
961+
A general-purpose record array constructor that dispatches to the
962962
appropriate `recarray` creation function based on the inputs (see Notes).
963963
964964
Parameters
@@ -996,7 +996,7 @@ def array(obj, dtype=None, shape=None, offset=0, strides=None, formats=None,
996996
`obj` is a string, then call the `fromstring` constructor. If `obj` is a
997997
list or a tuple, then if the first object is an `~numpy.ndarray`, call
998998
`fromarrays`, otherwise call `fromrecords`. If `obj` is a
999-
`~numpy.recarray`, then make a copy of the data in the recarray
999+
`~numpy.recarray`, then make a copy of the data in the recarray
10001000
(if ``copy=True``) and use the new formats, names, and titles. If `obj`
10011001
is a file, then call `fromfile`. Finally, if obj is an `ndarray`, then
10021002
return ``obj.view(recarray)``, making a copy of the data if ``copy=True``.

numpy/distutils/ccompiler_opt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2186,7 +2186,7 @@ def try_dispatch(self, sources, src_dir=None, **kwargs):
21862186
21872187
See Also
21882188
--------
2189-
parse_targets() :
2189+
parse_targets :
21902190
Parsing the configuration statements of dispatch-able sources.
21912191
"""
21922192
to_compile = {}

numpy/doc/constants.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ def add_newdoc(module, name, doc):
135135
"""
136136
A convenient alias for None, useful for indexing arrays.
137137
138-
See Also
139-
--------
140-
`numpy.doc.indexing`
141-
142138
Examples
143139
--------
144140
>>> newaxis is None

numpy/lib/function_base.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4229,10 +4229,9 @@ def meshgrid(*xi, copy=True, sparse=False, indexing='xy'):
42294229
42304230
See Also
42314231
--------
4232-
index_tricks.mgrid : Construct a multi-dimensional "meshgrid"
4233-
using indexing notation.
4234-
index_tricks.ogrid : Construct an open multi-dimensional "meshgrid"
4235-
using indexing notation.
4232+
mgrid : Construct a multi-dimensional "meshgrid" using indexing notation.
4233+
ogrid : Construct an open multi-dimensional "meshgrid" using indexing
4234+
notation.
42364235
42374236
Examples
42384237
--------

numpy/lib/nanfunctions.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def nanmin(a, axis=None, out=None, keepdims=np._NoValue):
244244
Alternate output array in which to place the result. The default
245245
is ``None``; if provided, it must have the same shape as the
246246
expected output, but the type will be cast if necessary. See
247-
`ufuncs-output-type` for more details.
247+
:ref:`ufuncs-output-type` for more details.
248248
249249
.. versionadded:: 1.8.0
250250
keepdims : bool, optional
@@ -359,7 +359,7 @@ def nanmax(a, axis=None, out=None, keepdims=np._NoValue):
359359
Alternate output array in which to place the result. The default
360360
is ``None``; if provided, it must have the same shape as the
361361
expected output, but the type will be cast if necessary. See
362-
`ufuncs-output-type` for more details.
362+
:ref:`ufuncs-output-type` for more details.
363363
364364
.. versionadded:: 1.8.0
365365
keepdims : bool, optional
@@ -584,7 +584,7 @@ def nansum(a, axis=None, dtype=None, out=None, keepdims=np._NoValue):
584584
Alternate output array in which to place the result. The default
585585
is ``None``. If provided, it must have the same shape as the
586586
expected output, but the type will be cast if necessary. See
587-
`ufuncs-output-type` for more details. The casting of NaN to integer
587+
:ref:`ufuncs-output-type` for more details. The casting of NaN to integer
588588
can yield unexpected results.
589589
590590
.. versionadded:: 1.8.0
@@ -681,7 +681,7 @@ def nanprod(a, axis=None, dtype=None, out=None, keepdims=np._NoValue):
681681
Alternate output array in which to place the result. The default
682682
is ``None``. If provided, it must have the same shape as the
683683
expected output, but the type will be cast if necessary. See
684-
`ufuncs-output-type` for more details. The casting of NaN to integer
684+
:ref:`ufuncs-output-type` for more details. The casting of NaN to integer
685685
can yield unexpected results.
686686
keepdims : bool, optional
687687
If True, the axes which are reduced are left in the result as
@@ -749,7 +749,7 @@ def nancumsum(a, axis=None, dtype=None, out=None):
749749
out : ndarray, optional
750750
Alternative output array in which to place the result. It must
751751
have the same shape and buffer length as the expected output
752-
but the type will be cast if necessary. See `ufuncs-output-type` for
752+
but the type will be cast if necessary. See :ref:`ufuncs-output-type` for
753753
more details.
754754
755755
Returns
@@ -888,7 +888,7 @@ def nanmean(a, axis=None, dtype=None, out=None, keepdims=np._NoValue):
888888
Alternate output array in which to place the result. The default
889889
is ``None``; if provided, it must have the same shape as the
890890
expected output, but the type will be cast if necessary. See
891-
`ufuncs-output-type` for more details.
891+
:ref:`ufuncs-output-type` for more details.
892892
keepdims : bool, optional
893893
If this is set to True, the axes which are reduced are left
894894
in the result as dimensions with size one. With this option,
@@ -1256,7 +1256,7 @@ def nanquantile(a, q, axis=None, out=None, overwrite_input=False,
12561256
Compute the qth quantile of the data along the specified axis,
12571257
while ignoring nan values.
12581258
Returns the qth quantile(s) of the array elements.
1259-
1259+
12601260
.. versionadded:: 1.15.0
12611261
12621262
Parameters
@@ -1472,7 +1472,7 @@ def nanvar(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue):
14721472
mean : Average
14731473
var : Variance while not ignoring NaNs
14741474
nanstd, nanmean
1475-
ufuncs-output-type
1475+
:ref:`ufuncs-output-type`
14761476
14771477
Notes
14781478
-----
@@ -1624,7 +1624,7 @@ def nanstd(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue):
16241624
--------
16251625
var, mean, std
16261626
nanvar, nanmean
1627-
ufuncs-output-type
1627+
:ref:`ufuncs-output-type`
16281628
16291629
Notes
16301630
-----

numpy/lib/scimath.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@
1414
Similarly, `sqrt`, other base logarithms, `power` and trig functions are
1515
correctly handled. See their respective docstrings for specific examples.
1616
17+
Functions
18+
---------
19+
20+
.. autosummary::
21+
:toctree: generated/
22+
23+
sqrt
24+
log
25+
log2
26+
logn
27+
log10
28+
power
29+
arccos
30+
arcsin
31+
arctanh
32+
1733
"""
1834
import numpy.core.numeric as nx
1935
import numpy.core.numerictypes as nt

0 commit comments

Comments
 (0)