Turning rows into columns
My mind was blown today while reading a good article on Pandas performance. The built-in zip function has magic powers I've never thought of before.
>>> x = [(1,2,3), (4,5,6)] >>> zip(*x) [(1, 4), (2, 5), (3, 6)]
Turn a list of rows into a list of columns! Of course, this can be done faster by using Pandas but you'll have to read the above referenced article for those details.
Published: 03-08-2013 22:21:00