diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2014-08-30 18:15:55 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2014-08-30 18:15:55 -0600 |
commit | 9c50f988ac27dd1758dbc46455573aaa77638c68 (patch) | |
tree | 962fe5433929148ad5fe2f24a4f3b193fcdbf6be /numpy/lib/function_base.py | |
parent | 45f8a181b7518836986fd03fc94c3845730bde44 (diff) | |
parent | f880b1aa7583d7c3dfc111a8b79e7e7ba364baf2 (diff) | |
download | numpy-9c50f988ac27dd1758dbc46455573aaa77638c68.tar.gz |
Merge pull request #5022 from seberg/structured-insert
BUG: Fix np.insert for inserting a single item into a structured array
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 257057666..3074a2f70 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -3763,7 +3763,9 @@ def insert(arr, obj, values, axis=None): if (index < 0): index += N - values = array(values, copy=False, ndmin=arr.ndim) + # There are some object array corner cases here, but we cannot avoid + # that: + values = array(values, copy=False, ndmin=arr.ndim, dtype=arr.dtype) if indices.ndim == 0: # broadcasting is very different here, since a[:,0,:] = ... behaves # very different from a[:,[0],:] = ...! This changes values so that |