[Numpy-discussion] indexing of arbitrary axis and arbitrary slice?

Chao YUE chaoyuejoy@gmail....
Sat Mar 16 11:40:51 CDT 2013


Dear all,

Is there some way to index the numpy array by specifying arbitrary axis and
arbitrary slice, while
not knowing the actual shape of the data?
For example, I have a 3-dim data, data.shape = (3,4,5)
Is there a way to retrieve data[:,0,:] by using something like
np.retrieve_data(data,axis=2,slice=0),
by this way you don't have to know the actual shape of the array.
for for 4-dim data, np.retrieve_data(data,axis=2,slice=0) will actually be
data[:,0,:,:]

thanks in advance,

Chao

-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130316/1f3f8e43/attachment.html 


More information about the NumPy-Discussion mailing list