How to change the major order of lists in python? -
i have list of n lists, each sub-list containing m elements.
how create list of m lists n elements each, containing n-th elements initial lists?
let's have this
mylist = [[1, 2, 3],[4, 5, 6]]
i want have
[[1, 4],[2, 5],[3, 6]]
performance important. have sublists of millions of elements (though, 1 dimension small: 1.000.000 x 8 )
this give tuples, it's trivial extend contain lists:
zip(*mylist)
i.e.
[list(i) in zip(*mylist)]
Comments
Post a Comment