[EMAIL PROTECTED] wrote:
> On Mar 18, 10:48 pm, [EMAIL PROTECTED] wrote:
>> [...fine solutions to the problem as asked...]
> Thank you both, a little more cumbersome than I expected, but it does
> the job! Thanks!
The obvious simple near-equivalent is:
data = range(33,99)
print data.ind
[EMAIL PROTECTED] wrote:
> Is there a function in Python analogous to the "where" function in
> IDL?
>
> x=[0,1,2,3,4,2,8,9]
> print where(x=2)
>
> output:
> [2,5]
If you're doing a lot of this kind of thing, you probably want to use
numpy::
>&
PROTECTED] wrote:
On Mar 18, 10:48 pm, [EMAIL PROTECTED] wrote:
vorticitywo:
Is there a function in Python analogous to the "where" function in
IDL?
Python gives very elastic syntax, you can simply do:
data = [0,1,2,3,4,2,8,9]
print [pos for pos, el in enumerate(data
On Mar 18, 10:48 pm, [EMAIL PROTECTED] wrote:
> vorticitywo:
>
> > Is there a function in Python analogous to the "where" function in
> > IDL?
>
> Python gives very elastic syntax, you can simply do:
>
> data = [0,1,2,3,4,2,8,9]
> print [pos for p
On 18 Mar, 15:19, [EMAIL PROTECTED] wrote:
> Is there a function in Python analogous to the "where" function in
> IDL?
>
> x=[0,1,2,3,4,2,8,9]
> print where(x=2)
>
> output:
> [2,5]
You can try this:
print filter( lambda x: a[x]==2, range(len(a)))
However it
vorticitywo:
> Is there a function in Python analogous to the "where" function in
> IDL?
Python gives very elastic syntax, you can simply do:
data = [0,1,2,3,4,2,8,9]
print [pos for pos, el in enumerate(data) if el==2]
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
Is there a function in Python analogous to the "where" function in
IDL?
x=[0,1,2,3,4,2,8,9]
print where(x=2)
output:
[2,5]
--
http://mail.python.org/mailman/listinfo/python-list
In article <[EMAIL PROTECTED]>, Robert Kern <[EMAIL PROTECTED]>
wrote:
>
> Right. "3 < data" creates an array of 0s and 1s where the condition is
> false and true, respectively. You don't need where() at all.
>
> Try
>
> mask = logical_and(3 < data, data <= 7)
Great. That's exactly what I n
Jorl Shefner wrote:
Could anyone tell me the efficient way to do this? Extracting values
from an array for a single condition (say all values greater than 'x')
using 'where' and 'compress' is simple enough.
from Numeric import arange,where,compress
data= arange(10)
data= [0, 1, 2, 3, 4, 5,
Could anyone tell me the efficient way to do this? Extracting values
from an array for a single condition (say all values greater than 'x')
using 'where' and 'compress' is simple enough.
>>> from Numeric import arange,where,compress
>>> data= arange(10)
>>> data= [0, 1, 2, 3, 4, 5, 6, 7, 8,
10 matches
Mail list logo