[Numpy-discussion] Can't set an element of a subset of an array, , ,
Robert Kern
robert.kern at gmail.com
Tue Dec 8 19:52:26 EST 2009
2009/12/8 <alan at ajackson.org>:
> Okay, I'm stuck. Why doesn't this work?
>
> In [226]: mask
> Out[226]: array([False, False, False, ..., False, False, False], dtype=bool)
> In [229]: mask[data['horizon']==i][2] = True
mask[data['horizon']==i] creates a copy. mask[data['horizon']==i][2]
assigns to the copy, which then gets thrown away.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion
mailing list