Many thanks for your willingness to help out with this. Not to
belabor the point, but I notice that the rules you lay out below don't
quite explain why the following syntax works as I originally expected:
r[0].field1 = 1
I'm guessing this is because r[0].field1 is already an existing
On Mon, Mar 2, 2009 at 19:20, Brian Gerke bge...@slac.stanford.edu wrote:
Many thanks for your willingness to help out with this. Not to
belabor the point, but I notice that the rules you lay out below don't
quite explain why the following syntax works as I originally expected:
r[0].field1
Hi-
I'm quite new to numpy and to python in general, so I apologize if I'm
missing something obvious, but I've come across some seemingly nasty
behavior when trying to assign values to the fields of an indexed
subarray of a numpy record array. Perhaps an example would explain
it best.
On Fri, Feb 27, 2009 at 18:26, Brian Gerke bge...@slac.stanford.edu wrote:
Hi-
I'm quite new to numpy and to python in general, so I apologize if I'm
missing something obvious, but I've come across some seemingly nasty
behavior when trying to assign values to the fields of an indexed
As a follow-up to Robert's answer:
r[r.field1 == 1].field2 = 1
doesn't work, but
r.field2[r.field1==1] = 1
does.
So far, so good.
Now I want to change the value of field2 for those same elements:
In [128]: r[where(r.field1 == 1.)].field2 = 1
Ok, so now the values of field
On Feb 27, 2009, at 4:30 PM, Robert Kern wrote:
r[where(r.field1 == 1.)] make a copy. There is no way for us to
construct a view onto the original memory for this circumstance given
numpy's memory model.
Many thanks for the quick reply. I assume that this is true only for
record arrays,
On Fri, Feb 27, 2009 at 19:06, Brian Gerke bge...@slac.stanford.edu wrote:
On Feb 27, 2009, at 4:30 PM, Robert Kern wrote:
r[where(r.field1 == 1.)] make a copy. There is no way for us to
construct a view onto the original memory for this circumstance given
numpy's memory model.
Many thanks