All Questions

11
votes
6answers
2443 views

Transpose / reshape dataframe without "timevar" from long to wide format

I have a data frame that follows the below long Pattern: Name MedName Name1 atenolol 25mg Name1 aspirin 81mg Name1 sildenafil 100mg Name2 atenolol 50mg Name2 enalapr...
124
votes
9answers
41445 views

Javascript equivalent of Python's zip function

Is there a javascript equivalent of Python's zip function? That is, given two arrays of equal lengths create an array of pairs. For instance, if I have three arrays that look like this: var array1 ...
330
votes
6answers
87314 views

Transpose/Unzip Function (inverse of zip)?

I have a list of 2-item tuples and I'd like to convert them to 2 lists where the first contains the first item in each tuple and the second list holds the second item. For example: original = [('a',...
5
votes
1answers
22418 views

Pivot Dynamic Columns, no Aggregation

I have questionnaire data in, SQL Server 2008, that I want to transpose to a matrix. I saw several posts about the same topic, but I just don't get pivoting. Given are following tables: Question...
79
votes
24answers
77539 views

An efficient way to transpose a file in Bash

I have a huge tab-separated file formatted like this X column1 column2 column3 row1 0 1 2 row2 3 4 5 row3 6 7 8 row4 9 10 11 I would like to transpose it in an efficient way using only bash command...
120
votes
9answers
78458 views

Transpose list of lists

Let's take: l = [[1,2,3],[4,5,6],[7,8,9]] The result I'm looking for is r = [[1,4,7],[2,5,8],[3,6,9]] and not r = [(1,4,7),(2,5,8),(3,6,9)] Much appreciated
71
votes
14answers
34243 views

Transposing a 2D-array in JavaScript

I've got an array of arrays, something like: [ [1,2,3], [1,2,3], [1,2,3], ] I would like to transpose it to get the following array: [ [1,1,1], [2,2,2], [3,3,3], ] It's n...
52
votes
8answers
64303 views

What is the fastest way to transpose a matrix in C++?

I have a matrix (relatively big) that I need to transpose. For example assume that my matrix is a b c d e f g h i j k l m n o p q r I want the result be as follows: a g m b h n c I o d j p e k q ...
13
votes
5answers
7917 views

Transpose column to row with Spark

I'm trying to transpose some columns of my table to row. I'm using Python and Spark 1.5.0. Here is my initial table: +-----+-----+-----+-------+ | A |col_1|col_2|col_...| +-----+------------------...
100
votes
12answers
189277 views

Transposing a NumPy array

I use Python and NumPy and have some problems with "transpose": a=array([5,4]) print a print a.T Invoking a.T is not transposing the array. If a is for example [[],[]] then it transposes correctly...

Previous Next