transpose_list()

home > kero > Documentation

kero.DataHandler.Generic.py

def transpose_list(input_list):
  return out

This is the usual matrix transpose operation defined 2D matrix in the form of for list of list.

input_list List of list. 2D matrix. Note that each item in the input_list is a row in the matrix.
out List of list. 2D matrix. The matrix transpose of input list.

Example usage

import kero.DataHandler.Generic as kg

mat = [[1,2],[3,4]]
for x in mat:
	print(x)

print("\nTransposed:")
for x in kg.transpose_list(mat):
	print(x)

The output is:

[1, 2]
[3, 4]

Transposed:
[1, 3]
[2, 4]

kero version: 0.1 and above