diff options
author | Chiara Marmo <cmarmo@users.noreply.github.com> | 2021-12-01 01:46:31 -1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-01 12:46:31 +0100 |
commit | 4194a94f08763599014e92713be8a63446cd76d4 (patch) | |
tree | 73a9f30d3d9cd21d9677e53c747f2e01f916b3ab | |
parent | 0bd7f2df20154370544925aacf7b1439d121cc53 (diff) | |
download | numpy-4194a94f08763599014e92713be8a63446cd76d4.tar.gz |
DOC: Fix some target not found Sphinx warnings. (#20140)
-rw-r--r-- | doc/source/reference/c-api/types-and-structures.rst | 5 | ||||
-rw-r--r-- | doc/source/user/basics.io.genfromtxt.rst | 14 | ||||
-rw-r--r-- | doc/source/user/basics.rec.rst | 11 | ||||
-rw-r--r-- | numpy/lib/recfunctions.py | 21 |
4 files changed, 29 insertions, 22 deletions
diff --git a/doc/source/reference/c-api/types-and-structures.rst b/doc/source/reference/c-api/types-and-structures.rst index 605a4ae71..1ea47b498 100644 --- a/doc/source/reference/c-api/types-and-structures.rst +++ b/doc/source/reference/c-api/types-and-structures.rst @@ -286,6 +286,11 @@ PyArrayDescr_Type and PyArray_Descr array like behavior. Each bit in this member is a flag which are named as: + .. c:member:: int alignment + + Non-NULL if this type is an array (C-contiguous) of some other type + + .. dedented to allow internal linking, pending a refactoring diff --git a/doc/source/user/basics.io.genfromtxt.rst b/doc/source/user/basics.io.genfromtxt.rst index 8fe7565aa..6a1ba75dd 100644 --- a/doc/source/user/basics.io.genfromtxt.rst +++ b/doc/source/user/basics.io.genfromtxt.rst @@ -231,9 +231,7 @@ When ``dtype=None``, the type of each column is determined iteratively from its data. We start by checking whether a string can be converted to a boolean (that is, if the string matches ``true`` or ``false`` in lower cases); then whether it can be converted to an integer, then to a float, -then to a complex and eventually to a string. This behavior may be changed -by modifying the default mapper of the -:class:`~numpy.lib._iotools.StringConverter` class. +then to a complex and eventually to a string. The option ``dtype=None`` is provided for convenience. However, it is significantly slower than setting the dtype explicitly. @@ -514,15 +512,15 @@ output array will then be a :class:`~numpy.ma.MaskedArray`. Shortcut functions ================== -In addition to :func:`~numpy.genfromtxt`, the :mod:`numpy.lib.npyio` module +In addition to :func:`~numpy.genfromtxt`, the ``numpy.lib.npyio`` module provides several convenience functions derived from :func:`~numpy.genfromtxt`. These functions work the same way as the original, but they have different default values. -:func:`~numpy.npyio.recfromtxt` +``numpy.lib.npyio.recfromtxt`` Returns a standard :class:`numpy.recarray` (if ``usemask=False``) or a - :class:`~numpy.ma.mrecords.MaskedRecords` array (if ``usemaske=True``). The + ``numpy.ma.mrecords.MaskedRecords`` array (if ``usemaske=True``). The default dtype is ``dtype=None``, meaning that the types of each column will be automatically determined. -:func:`~numpy.npyio.recfromcsv` - Like :func:`~numpy.npyio.recfromtxt`, but with a default ``delimiter=","``. +``numpy.lib.npyio.recfromcsv`` + Like ``numpy.lib.npyio.recfromtxt``, but with a default ``delimiter=","``. diff --git a/doc/source/user/basics.rec.rst b/doc/source/user/basics.rec.rst index 1e6f30506..7f487f39b 100644 --- a/doc/source/user/basics.rec.rst +++ b/doc/source/user/basics.rec.rst @@ -579,12 +579,13 @@ As an optional convenience numpy provides an ndarray subclass, attribute instead of only by index. Record arrays use a special datatype, :class:`numpy.record`, that allows field access by attribute on the structured scalars obtained from the array. -The :mod:`numpy.rec` module provides functions for creating recarrays from +The ``numpy.rec`` module provides functions for creating recarrays from various objects. Additional helper functions for creating and manipulating structured arrays can be found in :mod:`numpy.lib.recfunctions`. -The simplest way to create a record array is with ``numpy.rec.array``:: +The simplest way to create a record array is with +:func:`numpy.rec.array <numpy.core.records.array>`:: >>> recordarr = np.rec.array([(1, 2., 'Hello'), (2, 3., "World")], ... dtype=[('foo', 'i4'),('bar', 'f4'), ('baz', 'S10')]) @@ -600,14 +601,14 @@ The simplest way to create a record array is with ``numpy.rec.array``:: >>> recordarr[1].baz b'World' -:func:`numpy.rec.array` can convert a wide variety of arguments into record -arrays, including structured arrays:: +:func:`numpy.rec.array <numpy.core.records.array>` can convert a wide variety +of arguments into record arrays, including structured arrays:: >>> arr = np.array([(1, 2., 'Hello'), (2, 3., "World")], ... dtype=[('foo', 'i4'), ('bar', 'f4'), ('baz', 'S10')]) >>> recordarr = np.rec.array(arr) -The :mod:`numpy.rec` module provides a number of other convenience functions for +The ``numpy.rec`` module provides a number of other convenience functions for creating record arrays, see :ref:`record array creation routines <routines.array-creation.rec>`. diff --git a/numpy/lib/recfunctions.py b/numpy/lib/recfunctions.py index a491f612e..ee4fbcd74 100644 --- a/numpy/lib/recfunctions.py +++ b/numpy/lib/recfunctions.py @@ -784,7 +784,8 @@ def repack_fields(a, align=False, recurse=False): This method removes any overlaps and reorders the fields in memory so they have increasing byte offsets, and adds or removes padding bytes depending - on the `align` option, which behaves like the `align` option to `np.dtype`. + on the `align` option, which behaves like the `align` option to + `numpy.dtype`. If `align=False`, this method produces a "packed" memory layout in which each field starts at the byte the previous field ended, and any padding @@ -917,11 +918,12 @@ def structured_to_unstructured(arr, dtype=None, copy=False, casting='unsafe'): dtype : dtype, optional The dtype of the output unstructured array. copy : bool, optional - See copy argument to `ndarray.astype`. If true, always return a copy. - If false, and `dtype` requirements are satisfied, a view is returned. + See copy argument to `numpy.ndarray.astype`. If true, always return a + copy. If false, and `dtype` requirements are satisfied, a view is + returned. casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional - See casting argument of `ndarray.astype`. Controls what kind of data - casting may occur. + See casting argument of `numpy.ndarray.astype`. Controls what kind of + data casting may occur. Returns ------- @@ -1020,11 +1022,12 @@ def unstructured_to_structured(arr, dtype=None, names=None, align=False, align : boolean, optional Whether to create an aligned memory layout. copy : bool, optional - See copy argument to `ndarray.astype`. If true, always return a copy. - If false, and `dtype` requirements are satisfied, a view is returned. + See copy argument to `numpy.ndarray.astype`. If true, always return a + copy. If false, and `dtype` requirements are satisfied, a view is + returned. casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional - See casting argument of `ndarray.astype`. Controls what kind of data - casting may occur. + See casting argument of `numpy.ndarray.astype`. Controls what kind of + data casting may occur. Returns ------- |