“Python List Transpose” Código de respuesta

Lista de transposición de Python

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

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

transpose_list = transpose.tolist()
Exuberant Eland

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()
Exuberant Eland

lista de transposición

x = [[0,1],[2,3]]
np.transpose(x).tolist()
array([[0, 2],
       [1, 3]])
Zany Zebra

Respuestas similares a “Python List Transpose”

Preguntas similares a “Python List Transpose”

Más respuestas relacionadas con “Python List Transpose” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código