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
Post a Comment