transpose

A Transpose/Unzip Function in Python

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', 1), ('b', 2), ('c', 3), ('d', 4)] # and I want to become... result = (['a', 'b', 'c', 'd'], [1, 2, 3, 4]) Is there a builtin function th...

Ruby and FasterCSV: converting uneven rows to columns

I have a CSV data file with rows that may have lots of columns 500+ and some with a lot less. I need to transpose it so that each row becomes a column in the output file. The problem is that the rows in the original file may not all have the same number of columns so when I try the transpose method of array I get an `transpose': elemen...

SQL to transpose row pairs to columns in MS ACCESS database

I have an MS Access database that contains translated sentences in source-target pairs (a translation memory for fellow users of CAT tools). Somewhat annoyingly, source and target are not stored in separate columns, but in rows linked by ID, like this: +---+----+--------------+ |id |lang| text | +---+----+--------------+ 1 a...

Oracle Columns to Rows

In Oracle 9i and 10g how to transpose columns to rows and vice versa? ...

How should I transpose a .NET program?

Would it be better to transpose a Microsoft .NET program to standalone by modifying the existing code, or to just use the existing code as a reference? By standalone, I mean that the .NET framework (nor any other) would not have to be installed on the machine. Preferably, I'd prefer the option which would take the least time, even if it ...

Query Transposing certain rows into column names

Hi all, I have a couple of tables which look like this Table 1 user_id | name ------------------------- x111 | Smith, James x112 | Smith, Jane etc.. Table 2 id | code | date | incident_code | user_id ----------------------------------------------------------------- 1 | 102008 | 10/2...

Directly fetching a list from a column's data with MySQL

Hello, Let us suppose I have to deal with lots of grandmothers that have lots of cats. I have a table granny_cat : granny_id | kitty_name -------------------- 1 Kizzy 1 Jimmy 1 Katty 2 Georges 2 Albert 3 Panther and I want to retrieve a list of granny 1 cat's, i.e. to get so...

How to transpose rows and columns in Access 2003?

How do I transpose rows and columns in Access 2003? I have a multiple tables that I need to do this on. (I've reworded my question because feedback tells me it was confusing how I originally stated it.) Each table has 30 fields and 20 records. Lets say my fields are Name, Weight, Zip Code, Quality4, Quality5, Quality6 through Qualit...

Best way to transpose a grid of data in a file

I have large data files of values on a 2D grid. They are organized such that subsequent rows of data in the grid are subsequent lines in the file. Each column is separated by a tab character. Essentially, this is a CSV file, but with tabs instead of columns. I need the transpose the data (first row becomes first column) and output it to...

Is there a safe way in Scala to transpose a List of unequal-length Lists?

Given the following List: val l = List(List(1, 2, 3), List(4, 5), List(6, 7, 8)) If I try to transpose it, Scala will throw the following error: scala> List.transpose(l) java.util.NoSuchElementException: head of empty list at scala.Nil$.head(List.scala:1365) at scala.Nil$.head(List.scala:1362) at scala.List$$anonfun$trans...

Transpose a file in bash

Hi all, 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 using commands (I could write a ten or so lines Perl script to do that, but it should be slower to execute than the native bash functions). So...

How to transpose data in powershell

I have a file that looks like this: a,1 b,2 c,3 a,4 b,5 c,6 (...repeat 1,000s of lines) How can I transpose it into this? a,b,c 1,2,3 4,5,6 Thanks ...

Transpose select results with Oracle

Hi All, my question is, with some background: I have to generate some sql queries based on the table metadata (column format), and the result is something like: TABLENAME1|COL1 TABLENAME1|COL2 TABLENAME2|COL1 TABLENAME2|COL2 TABLENAME2|COL3 TABLENAME3|COL1 TABLENAME4|COL1 TABLENAME4|COL2 ... /*some other 1800 rows */ (Yeah, it's ord...

Transpose a row into columns with MySQL without using UNIONS?

I have a table that is similar to the following below: id | cat | one_above | top_level | 0 'printers' 'hardware' 'computers' I want to be able to write a query, without using unions, that will return me a result set that transposes this table's columns into rows. What this mean...

how to use a macro to transpose data from rows into columns

I am totally new to VBA (aside from recording and running manually) so was hoping somebody could help me with designing this. I have a worksheet with unspecified # of rows per unique ID (column A), based on date and type. : A B C D 1 12Jan2010 type A Person1 1 16Jan2010 type B Person1 ...

Easiest way to transpose an image (rotate by 90 degrees) using OpenCV?

What is the best way (in c/c++) to rotate an IplImage by 90 degrees? I would assume that there must be something better than transforming it using a matrix, but I can't seem to find anything other than that in the API and online. ...

Python UUID represented as special characters

When creating a UUID in Python, likeso: >>> uuid.uuid1() UUID('a8098c1a-f86e-11da-bd1a-00112444be1e') How could one map that UUID into a string made up of the capitalized alphabet A-Z minus the characters D, F, I, O, Q, and U, plus the numerical digits, plus the characters "+" and "=". i.e. the from an integer or string onto the set o...

Transpose one row into many rows Oracle

I have a query that always returns one row, with many columns. I would like to turn this into 2 columns and many rows. Original results: Col1, Col2, Col3, Col4 ---------------------- val1, val2, val3, val4 What I want: ColName, Value -------------- Col1, val1 Col2, val2 Col3, val3 Col4, val4 Is this possible? EDIT ...

Vacancy Tracking Algorithm implementation in C++

I'm trying to use the vacancy tracking algorithm to perform transposition of multidimensional arrays in C++. The arrays come as void pointers so I'm using address manipulation to perform the copies. Basically, there is an algorithm that starts with an offset and works its way through the whole 1-d representation of the array like swi...

transpose 1D array of leading dimension N

how can i transpose an 1d array of leading dimension N, without extra space ? any language is fine ...