Answers for "how to transpose a 2d list in python"

1

python list transpose

# Use numpy. T to transpose a list of lists, from kite.com

list_of_lists = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

numpy_array = np.array(list_of_lists)
transpose = numpy_array.T
transpose `numpy_array`

transpose_list = transpose.tolist()
Posted by: Guest on May-16-2020

Code answers related to "how to transpose a 2d list in python"

Python Answers by Framework

Browse Popular Code Answers by Language