Hi,
Is there some straightforward way to access an array by values across a
subset of its dimensions? For example, if I have a three dimensional
array a=(x,y,z), can I look at the values of z given particular values
for x and y?
Thanks,
Ted
___
I am afraid you have to write index inquire function by yourself. I did
like this.
chao
2012/1/30 Ted To rainexpec...@theo.to
Hi,
Is there some straightforward way to access an array by values across a
subset of its dimensions? For example, if I have a three dimensional
array a=(x,y,z),
On Mon, Jan 30, 2012 at 3:25 PM, Ted To rainexpec...@theo.to wrote:
Is there some straightforward way to access an array by values across a
subset of its dimensions? For example, if I have a three dimensional
array a=(x,y,z), can I look at the values of z given particular values
for x and y?
a[x,y,:]
Read the slicing part of the tutorial:
http://www.scipy.org/Tentative_NumPy_Tutorial
(section 1.6)
And the documentation:
http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
On Jan 30, 2012, at 10:25 AM, Ted To wrote:
Hi,
Is there some straightforward way to access
he is not asking for slicing. he is asking for how to index array by
element value but not element index.
2012/1/30 Zachary Pincus zachary.pin...@yale.edu
a[x,y,:]
Read the slicing part of the tutorial:
http://www.scipy.org/Tentative_NumPy_Tutorial
(section 1.6)
And the documentation:
Ted, can you clarify what you're asking for? Maybe give a trivial example of an
array and the desired output?
I'm pretty sure this is a slicing question though:
If I have a three dimensional array a=(x,y,z), can I look at the values of z
given particular values for x and y?
Given that element
Sure thing. To keep it simple suppose I have just a two dimensional
array (time,output):
[(1,2),(2,3),(3,4)]
I would like to look at all values of output for which, for example time==2.
My actual application has a six dimensional array and I'd like to look
at the contents using one or more of
On Mon, Jan 30, 2012 at 10:57 AM, Ted To rainexpec...@theo.to wrote:
Sure thing. To keep it simple suppose I have just a two dimensional
array (time,output):
[(1,2),(2,3),(3,4)]
I would like to look at all values of output for which, for example time==2.
My actual application has a six
On 01/30/2012 12:13 PM, Brett Olsen wrote:
On Mon, Jan 30, 2012 at 10:57 AM, Ted To rainexpec...@theo.to wrote:
Sure thing. To keep it simple suppose I have just a two dimensional
array (time,output):
[(1,2),(2,3),(3,4)]
I would like to look at all values of output for which, for example
Thanks! That works great if I only want to search over one index but I
can't quite figure out what to do with more than a single index. So
suppose I have a labeled, multidimensional array with labels 'month',
'year' and 'quantity'. a[['month','year']] gives me an array of indices
but
On Mon, Jan 30, 2012 at 11:31 AM, Ted To rainexpec...@theo.to wrote:
On 01/30/2012 12:13 PM, Brett Olsen wrote:
On Mon, Jan 30, 2012 at 10:57 AM, Ted To rainexpec...@theo.to wrote:
Sure thing. To keep it simple suppose I have just a two dimensional
array (time,output):
[(1,2),(2,3),(3,4)]
I
You'd want to update your mask appropriately to get everything you
want to select, one criteria at a time e.g.:
mask = a[:,0] == 1
mask = a[:,1] == 1960
Alternatively:
mask = (a[:,0] == 1) (a[:,1] == 1960)
but be careful with the parens, and | are normally high-priority
bitwise
12 matches
Mail list logo