[Numpy-discussion] simple way to denote unchanged dimension in reshape?

Chao YUE chaoyuejoy at gmail.com
Thu May 29 05:29:37 EDT 2014


Dear all,

I have a simple question. Is there a way to denote the unchanged dimension
in the reshape function? like suppose I have an array named "arr" having
three dims with the first dimension length as 48, I want to reshape the
first dim into 12*4, but keeping all the other dimension length unchanged.

like when we slice the array, we can use:  arr[10:40, ... ], "...'
represents all remaining dimesions.

however when doing reshape, we must use:
arr.reshape(12,-1,arr.shape(1),arr.shape(2))

Is there something allowing more flexible reshape, like:
arr.reshape(12,-1,...)?

thanks a lot in advance,

best,

Chao
-- 
please visit:
http://www.globalcarbonatlas.org/
***********************************************************************************
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.python.org/pipermail/numpy-discussion/attachments/20140529/19a69b0e/attachment.html>


More information about the NumPy-Discussion mailing list