python - Efficient method to transpose submatrix in a numpy array -


i have large numpy array of matrix has structure:

np.array([            [[1, 2],             [3, 4]],            [[5, 6],             [7, 8]],          ]) 

my expected output

np.array([            [[1, 3],             [2, 4]],            [[5, 7],             [6, 8]],          ]) 

i know methods using list comprehension or loops , create numpy array again, methods involving creating numpy list slow data. , vectorize seems working on numbers.

when use normal python lists or other languages, can map transpose function list, seems there no similar function in numpy.

how can efficiently?


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -