Is there any fast method to make a transposition of a rectangular 2D matrix in Python (non-involving any library import).?
Say, if I have an array
>>> X = [1,2,3], [4,5,6]] >>> zip(*X) [(1,4), (2,5), (3,6)] >>> [list(tup) for tup in zip(*X)] [[1,4], [2,5], [3,6]]
If the inner pairs absolutely need to be lists, go with the second.