Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python transpose

a = [(1, 'John', 1996),
    (2, 'Doodie', 2001),
    (3, 'Doe', 2006)]
b = list(zip(*a))
#[(1, 2, 3),
#('John', 'Doodie', 'Doe'),
#(1996, 2001, 2006)]
'''O(m*n) time complexity, if data >1000, use numpy or pandas'''
 
PREVIOUS NEXT
Tagged: #python #transpose
ADD COMMENT
Topic
Name
7+1 =