diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2014-08-30 09:25:52 +0100 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2014-08-30 17:57:31 +0100 |
commit | f880b1aa7583d7c3dfc111a8b79e7e7ba364baf2 (patch) | |
tree | 0b4f8c6f238ac664df782e54cd2f414ff611f28b /numpy/lib/function_base.py | |
parent | 709a06d0e9db862a8dd519db13724a4c59de7d69 (diff) | |
download | numpy-f880b1aa7583d7c3dfc111a8b79e7e7ba364baf2.tar.gz |
BUG: Fix np.insert for inserting a single item into a structured array
Note that there are some object array special cases because of allowing
multiple inserts. `np.array(..., dtype=object)` is not always clear.
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 087d1cbb5..ff69b07dc 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -3758,7 +3758,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 |