Skip to main content

Transposes columns and rows in delimited text files

Project description

You got columnar data? Turn that into row-wise data!! You got row-wise data?? Turn it into columnar data!!! SAY WUT?!?

(transposer transposes columns and rows in delimited text files)

What It Does

transposer is a one-trick pony, but it’s a good one-trick pony. A simple command-line tool that can be used to effectively transpose columnar data in a delimited file to row-wise data. EPIC.

Consider these three rows of data:


transposer would take these three rows, and transpose the data as follows:


If you wanted to transform the row-wise data back into its former columnar self, you would just run transposer against the transposed data.

transposer also works well with different types of delimiters, you just need to declare which type you are working with (default is comma-separated).

But, Keith

It’s so easy to transpose that kind of data by hand. Why would I want to use a package for it?

Yeah, transposing three rows is easy to do by hand. Try 100,000. transposer will do that work for you so you can do better things like watch reruns of The Shawshank Redemption. You don’t even have to write the data out to another file you can also just hold onto it to do some wicked transforms before you dump it to a flatfile. Up to you.


Installing is easy, just use pip:

$ pip install transposer

Or grab this repo and run:

$ python install


transposer can be used both on the command line as well as in a Python project.

Command Line

$ transposer -i 'my_file.csv' -o 'out_file.csv'
$ transposer -i 'my_file.txt' -d '|'
$ transposer --in 'my_file.txt' -d '\t'


In your project file:

import transposer

# this will output a file.
transposer.transpose(i='cols.csv', o='rows.csv')

# this will just keep the transposition in memory
rows = transposer.transpose(i='cols.csv', o=None)

# so will this
rows = transposer.transpose(i='cols.csv')

# the delimiter defaults to a comma. Use pipes too.
transposer.transpose(i='cols.txt', o='rows.txt', d='|')


transposer uses the MIT license, and is free for you.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transposer-0.0.3.tar.gz (3.5 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page