[SciPy-User] &lt; transferred from Scipy-Dev&gt; Re: Seeking help/ advice for applying functions
Tue Mar 9 17:09:32 CST 2010
Anne Archibald <peridot.faceted <at> gmail.com> writes:
> > Hmm, but I think that's what not possible in my particular case! That's
> > depends on what happens externally. I don't have any control of it.
> What I mean is something like:
> A[A>3] = F(A[A>3])
> A[A<=3] = G(A[A<=3])
But ah, this looks so much what I'm looking for. Let me still digest this for
a while (please be patient, while I'm groking this. The A[A>3] part is very
clear, but I still have to confirm my self that F(A[A>3]) is really
meaningfull. In my particular case A[A>3]= is not relevant).
> Not that this is the most efficient way to write this sort of thing,
> but it is a way to apply the appropriate function to each element in
> the array.
> >> remember numpy lets you select out all the elements of an array
> >> meeting a criterion.
> > As far as I understod, select and where gives you only the first one.
> > In my case I need all of them.
> There are many different functions for picking just some elements out
> of an array, and for putting results back in the correct places. This
> kind of operation - pull out certain elements, do some operation to
> them, put the new values back in place of the old - happens all the
> time, and numpy has all sorts of tools to support it.
I do understand, it's not the language per se, but the fluid browsing of libs
and the ability to utilize them. You have allready guided me a lot.
More information about the SciPy-User