In [1]:
import numpy as np
import pandas as pd

In [2]:
l_2d = [[0, 1, 2], [3, 4, 5]]

In [3]:
arr_t = np.array(l_2d).T

print(arr_t)
print(type(arr_t))


[[0 3]
 [1 4]
 [2 5]]
<class 'numpy.ndarray'>

In [4]:
l_2d_t = np.array(l_2d).T.tolist()

print(l_2d_t)
print(type(l_2d_t))


[[0, 3], [1, 4], [2, 5]]
<class 'list'>

In [5]:
df_t = pd.DataFrame(l_2d).T

print(df_t)
print(type(df_t))


   0  1
0  0  3
1  1  4
2  2  5
<class 'pandas.core.frame.DataFrame'>

In [6]:
l_2d_t = pd.DataFrame(l_2d).T.values.tolist()

print(l_2d_t)
print(type(l_2d_t))


[[0, 3], [1, 4], [2, 5]]
<class 'list'>

In [7]:
l_2d_t_tuple = list(zip(*l_2d))

print(l_2d_t_tuple)
print(type(l_2d_t_tuple))


[(0, 3), (1, 4), (2, 5)]
<class 'list'>

In [8]:
print(l_2d_t_tuple[0])
print(type(l_2d_t_tuple[0]))


(0, 3)
<class 'tuple'>

In [9]:
l_2d_t = [list(x) for x in zip(*l_2d)]

print(l_2d_t)
print(type(l_2d_t))


[[0, 3], [1, 4], [2, 5]]
<class 'list'>

In [10]:
print(l_2d_t[0])
print(type(l_2d_t[0]))


[0, 3]
<class 'list'>

In [11]:
print(*l_2d)


[0, 1, 2] [3, 4, 5]

In [12]:
print(list(zip([0, 1, 2], [3, 4, 5])))


[(0, 3), (1, 4), (2, 5)]

In [13]:
print([list(x) for x in [(0, 3), (1, 4), (2, 5)]])


[[0, 3], [1, 4], [2, 5]]