diff options
author | Allan Haldane <allan.haldane@gmail.com> | 2015-01-16 23:53:41 -0500 |
---|---|---|
committer | Allan Haldane <allan.haldane@gmail.com> | 2015-01-22 17:36:43 -0500 |
commit | 1bd0b4e8f176cd80e81b5f50832db5f8ba1ee1e9 (patch) | |
tree | fce876400e049c7927cfe4b62ee4d1ca00a8ed7b /doc/source/reference/arrays.indexing.rst | |
parent | b69035e8ea28bd759b929822aaba544d3c5f8c30 (diff) | |
download | numpy-1bd0b4e8f176cd80e81b5f50832db5f8ba1ee1e9.tar.gz |
DOC: improve record/structured array nomenclature & guide
This update adds a section better describing record arrays in the user
guide (numpy/doc/structured_arrays.py).
It also corrects nomenclature, such that "structured array" refers to
ndarrays with structured dtype, "record array" refers to modified
ndarrays as created by np.rec.array, and "recarray" refers to ndarrays
viewed as np.recarray. See the note at the end of the structured
array user guide.
Diffstat (limited to 'doc/source/reference/arrays.indexing.rst')
-rw-r--r-- | doc/source/reference/arrays.indexing.rst | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/doc/source/reference/arrays.indexing.rst b/doc/source/reference/arrays.indexing.rst index ef0180e0f..2eb07c4e0 100644 --- a/doc/source/reference/arrays.indexing.rst +++ b/doc/source/reference/arrays.indexing.rst @@ -11,7 +11,7 @@ Indexing :class:`ndarrays <ndarray>` can be indexed using the standard Python ``x[obj]`` syntax, where *x* is the array and *obj* the selection. -There are three kinds of indexing available: record access, basic +There are three kinds of indexing available: field access, basic slicing, advanced indexing. Which one occurs depends on *obj*. .. note:: @@ -489,25 +489,25 @@ indexing (in no particular order): view on the data. This *must* be done if the subclasses ``__getitem__`` does not return views. -.. _arrays.indexing.rec: +.. _arrays.indexing.fields: -Record Access +Field Access ------------- .. seealso:: :ref:`arrays.dtypes`, :ref:`arrays.scalars` -If the :class:`ndarray` object is a record array, *i.e.* its data type -is a :term:`record` data type, the :term:`fields <field>` of the array -can be accessed by indexing the array with strings, dictionary-like. +If the :class:`ndarray` object is a structured array the :term:`fields <field>` +of the array can be accessed by indexing the array with strings, +dictionary-like. Indexing ``x['field-name']`` returns a new :term:`view` to the array, which is of the same shape as *x* (except when the field is a sub-array) but of data type ``x.dtype['field-name']`` and contains -only the part of the data in the specified field. Also record array -scalars can be "indexed" this way. +only the part of the data in the specified field. Also +:ref:`record array <arrays.classes.rec>` scalars can be "indexed" this way. -Indexing into a record array can also be done with a list of field names, +Indexing into a structured array can also be done with a list of field names, *e.g.* ``x[['field-name1','field-name2']]``. Currently this returns a new array containing a copy of the values in the fields specified in the list. As of NumPy 1.7, returning a copy is being deprecated in favor of returning |