On 2013/08/25 2:30 PM, Cera, Tim wrote: > I have done this before, but am now really confused. > > Created an array 'day' specifying the 'f' type > > In [29]: day > Out[29]: array([ 5., 5.], dtype=float32) > > # Have a mask... > In [30]: mask > Out[30]: array([ True, False], dtype=bool) > > # So far, so good... > In [31]: day[mask] > Out[31]: array([ 5.], dtype=float32) > > In [32]: day[mask] = 10 > > # What? > In [33]: day > Out[33]: array([ 10., 10.], dtype=float32) >
I don't get it with 1.7.1, either: In [2]: np.__version__ Out[2]: '1.7.1' In [3]: %paste mask = np.array([True, False], dtype=bool) day = np.array([5, 5], dtype=np.float32) day mask day[mask] day[mask] = 10 day ## -- End pasted text -- Out[3]: array([ 10., 5.], dtype=float32) My 1.7.0 example is on a Mac, the 1.7.1 is on a Linux virtual machine, both 64-bit. Eric > > So I created an integer array 'a' > > In [38]: a > Out[38]: array([11, 1]) > > In [39]: a[mask] > Out[39]: array([11]) > > In [40]: a[mask] = 12 > > # This is what I expect. > In [41]: a > Out[41]: array([12, 1]) > > Am I missing something? Is this supposed to happen? > > Version 1.7.1. > > Kindest regards, > Tim > _______________________________________________ > NumPy-Discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion > _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
