On Mon, Mar 2, 2009 at 19:20, Brian Gerke 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 = 1
>
> I'm guessin
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 scalar
On Fri, Feb 27, 2009 at 19:06, Brian Gerke 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 for the qui
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 array
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 value
On Fri, Feb 27, 2009 at 18:26, Brian Gerke 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
> subarray of a numpy reco
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.