# [NumPy-Tickets] [NumPy] #1645: Setting a value to an indexed array with composite dtype using where or a boolean mask silently fails

NumPy Trac numpy-tickets@scipy....
Wed Oct 20 14:28:24 CDT 2010

```#1645: Setting a value to an indexed array with composite dtype using where or a
--------------------+-------------------------------------------------------
Reporter:  pch     |       Owner:  somebody
Type:  defect  |      Status:  new
Priority:  normal  |   Milestone:  2.0.0
Component:  Other   |     Version:  1.5.0
Keywords:          |
--------------------+-------------------------------------------------------
The following ways to set an array with composite dtype (or fwiw a
recarray) fail. Only using a slice works correctly

{{{
>>> a=zeros((10,), dtype=[('f',int)])
>>> a
array([(0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,)],
dtype=[('f', '<i8')])

>>> i=array(range(10))
>>> a[i<=5]['f'] = 1
>>> a
array([(0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,)],
dtype=[('f', '<i8')])

>>> a[where(i<=5)]['f'] = 1
>>> a
array([(0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,)],
dtype=[('f', '<i8')])

>>> a[0:5:2]['f'] = 1
>>> a
array([(1,), (0,), (1,), (0,), (1,), (0,), (0,), (0,), (0,), (0,)],
dtype=[('f', '<i8')])

}}}

--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1645>
NumPy <http://projects.scipy.org/numpy>
My example project
```