diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-12-01 10:29:03 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-01 10:29:03 -0800 |
commit | b637e654706ae7efbf556091cb663197e2f28774 (patch) | |
tree | 5841e9994afaa0fcbdc5aea56e42433e89eab956 /doc | |
parent | e0122a4fc3bf9453220c2802a50c253a381b59c9 (diff) | |
parent | 845def00c85f9f40cfa64e6dabb4158bebd502f4 (diff) | |
download | numpy-b637e654706ae7efbf556091cb663197e2f28774.tar.gz |
Merge pull request #12447 from ahaldane/unrevert_multifield_view
ENH: add back the multifield copy->view change
Diffstat (limited to 'doc')
-rw-r--r-- | doc/release/1.16.0-notes.rst | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/release/1.16.0-notes.rst b/doc/release/1.16.0-notes.rst index b77aa9698..0907bba11 100644 --- a/doc/release/1.16.0-notes.rst +++ b/doc/release/1.16.0-notes.rst @@ -67,6 +67,10 @@ Expired deprecations * ``np.lib.function_base.unique`` was removed, finishing a deprecation cycle begun in NumPy 1.4. Use `numpy.unique` instead. +* multi-field indexing now returns views instead of copies, finishing a + deprecation cycle begun in NumPy 1.7. The change was previously attempted in + NumPy 1.14 but reverted until now. + Compatibility notes =================== @@ -113,6 +117,23 @@ Previously, only the ``dims`` keyword argument was accepted for specification of the shape of the array to be used for unraveling. ``dims`` remains supported, but is now deprecated. +multi-field views return a view instead of a copy +------------------------------------------------- +Indexing a structured array with multiple fields, e.g., +``arr[['f1', 'f3']]``, returns a view into the original array instead of a +copy. The returned view will often have extra padding bytes corresponding to +intervening fields in the original array, unlike before, which will +affect code such as ``arr[['f1', 'f3']].view('float64')``. This change has +been planned since numpy 1.7 and such operations have emitted +``FutureWarnings`` since then and more since 1.12. + +To help users update their code to account for these changes, a number of +functions have been added to the ``numpy.lib.recfunctions`` module which +safely allow such operations. For instance, the code above can be replaced +with ``structured_to_unstructured(arr[['f1', 'f3']], dtype='float64')``. +See the "accessing multiple fields" section of the +`user guide <https://docs.scipy.org/doc/numpy/user/basics.rec.html>`__. + C API changes ============= |