python column split

numpy, python

Solution

I think NumPy is good for this:

>>> import numpy as np
>>> my_list = [[1,2,3],[4,5,6],[7,8,9]]
>>> x = np.array(my_list)
>>> np.transpose(x).tolist()
[[1, 4, 7], [2, 5, 8], [3, 6, 9]]

Problem

I have a python array in the format: ``` [[1,2,3],[4,5,6],[7,8,9]] ``` Is there a way for me to break it up into columns to give: ``` [[1,4,7],[2,5,8],[3,6,9]] ```

Original source

Related problems