<div dir="auto">Hi, <div dir="auto"><br></div><div dir="auto">This works, but reshape doesn't move data around. What happens is that the data is flattened and then reshaped. If your 5 is not supposed to move, you should create a 2,5,4 array and then copy the two slices by hand, or use transpose (make it 5,4,2 and then transpose to 2,5,4=.</div><div dir="auto"><br></div><div dir="auto">Matthieu </div></div><div class="gmail_extra"><br><div class="gmail_quote">Le 10 juil. 2017 11:40 AM,  <<a href="mailto:paul.carrico@free.fr">paul.carrico@free.fr</a>> a écrit :<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Dear All</p>
<p>I'm looking in a way to reshape a 2D matrix into a 3D one ; in my example I want to <span style="text-decoration:underline"><strong>move the columns from the 4th to the 8th in the 2nd plane</strong>  </span>(3rd dimension i guess)</p>
<p>a =  np.random.rand(5,8); print(a)</p>
<p>I tried</p>
<p>a = p.reshape(d, (2,5,4), ) but it is not what I'm expecting</p>
<p><br></p>
<p>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</p>
<p><a href="https://stackoverflow.com/questions/31686989/numpy-reshape-and-partition-2d-array-to-3d" target="_blank">https://stackoverflow.com/<wbr>questions/31686989/numpy-<wbr>reshape-and-partition-2d-<wbr>array-to-3d</a></p>
<p><br></p>
<p>Thanks for your support</p>
<p><br></p>
<p>Paul</p>
<p><br></p>
<p><br></p>
<p><br></p>

</div>
<br>______________________________<wbr>_________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/numpy-<wbr>discussion</a><br>
<br></blockquote></div></div>