summaryrefslogtreecommitdiff
path: root/doc/source/user/basics.rec.rst
diff options
context:
space:
mode:
Diffstat (limited to 'doc/source/user/basics.rec.rst')
-rw-r--r--doc/source/user/basics.rec.rst8
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/source/user/basics.rec.rst b/doc/source/user/basics.rec.rst
index 7f487f39b..4b4b8815f 100644
--- a/doc/source/user/basics.rec.rst
+++ b/doc/source/user/basics.rec.rst
@@ -15,7 +15,7 @@ datatypes organized as a sequence of named :term:`fields <field>`. For example,
... dtype=[('name', 'U10'), ('age', 'i4'), ('weight', 'f4')])
>>> x
array([('Rex', 9, 81.), ('Fido', 3, 27.)],
- dtype=[('name', 'U10'), ('age', '<i4'), ('weight', '<f4')])
+ dtype=[('name', '<U10'), ('age', '<i4'), ('weight', '<f4')])
Here ``x`` is a one-dimensional array of length two whose datatype is a
structure with three fields: 1. A string of length 10 or less named 'name', 2.
@@ -24,7 +24,7 @@ a 32-bit integer named 'age', and 3. a 32-bit float named 'weight'.
If you index ``x`` at position 1 you get a structure::
>>> x[1]
- ('Fido', 3, 27.0)
+ ('Fido', 3, 27.)
You can access and modify individual fields of a structured array by indexing
with the field name::
@@ -34,7 +34,7 @@ with the field name::
>>> x['age'] = 5
>>> x
array([('Rex', 5, 81.), ('Fido', 5, 27.)],
- dtype=[('name', 'U10'), ('age', '<i4'), ('weight', '<f4')])
+ dtype=[('name', '<U10'), ('age', '<i4'), ('weight', '<f4')])
Structured datatypes are designed to be able to mimic 'structs' in the C
language, and share a similar memory layout. They are meant for interfacing with
@@ -425,7 +425,7 @@ array, as follows::
>>> a = np.zeros(3, dtype=[('a', 'i4'), ('b', 'i4'), ('c', 'f4')])
>>> a[['a', 'c']]
array([(0, 0.), (0, 0.), (0, 0.)],
- dtype={'names':['a','c'], 'formats':['<i4','<f4'], 'offsets':[0,8], 'itemsize':12})
+ dtype={'names': ['a', 'c'], 'formats': ['<i4', '<f4'], 'offsets': [0, 8], 'itemsize': 12})
Assignment to the view modifies the original array. The view's fields will be
in the order they were indexed. Note that unlike for single-field indexing, the