[Numpy-discussion] reshape 2D array into 3D

paul.carrico at free.fr paul.carrico at free.fr
Mon Jul 10 08:20:33 EDT 2017


Dear All 

I'm looking in a way to reshape a 2D matrix into a 3D one ; in my
example I want to MOVE THE COLUMNS FROM THE 4TH TO THE 8TH IN THE 2ND
PLANE  (3rd dimension i guess) 

a =  np.random.rand(5,8); print(a) 

I tried 

a = p.reshape(d, (2,5,4), ) but it is not what I'm expecting 

Nota : it looks like the following task (while I want to split it in 2
levels and not in 4), but I've not understood at all 

https://stackoverflow.com/questions/31686989/numpy-reshape-and-partition-2d-array-to-3d


Thanks for your support 

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20170710/aa4f37e9/attachment.html>


More information about the NumPy-Discussion mailing list