Python Forum

Full Version: reshape from 3D to 3D matrix
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

In the following example, I'm still trying to find a way to reshape the 2D matrix into a 3D one:
  • the columns remain unchaged
  • they are moved in depth column 1 moves to (1, x, x), column 2 moves to (2, x, x) and so on


But is reshape the best tool?

Thanks for any advice

Paul
n = 100
m = 10
# order = 'C' => in line
# order = 'F' => in columns
A = np.arange(n*m).reshape( (n, m), order='F') 
B = np.reshape(A, (10,n,1), order='F')
C = np.reshape(A, (10,n,1), order='C')
D = np.reshape(A, (10,n,1), order='A')