[SciPy-user] Slicing 3D array using two 1D arrays not working

Dharhas Pothina Dharhas.Pothina at twdb.state.tx.us
Thu May 22 11:46:01 EDT 2008


Hi,

I have an array a 3D array 'a' (a.shape = a(6, 21216, 2) ) and I want to slice it using a[levels,nodes,:] where
levels=array([2,4]),nodes=array([12,1234,4566,1233]) etc.

I can do    

b=a[:,nodes,:]
c=b[levels,:,:]

but if I try 
c=a[levels,nodes,:]

ValueError: shape mismatch: objects cannot be broadcast to a single shape

is there something I am doing wrong or is this just not possible?

thanks

- dharhas



More information about the SciPy-User mailing list