GitHub - CJWorkbench/transpose: Workbench module that converts rows to columns and columns to rows.

Workbench module that converts rows to columns and columns to rows.

Features

  • The user may choose a column-header column. (The default is to name output columns '0', '1', etc.)
  • Throws an error on duplicate column names by default. The user may override the error.
  • Limits the output table to 1,000 columns.
  • Warns and converts all output to str if input has mixed types.
  • Converts output column names to text, even if the first column is int.

Missing Features

  • Type conversion does not respect column formats. (It just uses str().) A warning lets the user prepend a "Convert to Text" module to correct any errors.

Developing

First, get up and running:

  1. python3 ./setup.py test # to test

To add a feature:

  1. Write a test in test_transpose.py
  2. Run python3 ./setup.py test to prove it breaks
  3. Edit transpose.py to make the test pass
  4. Run python3 ./setup.py test to prove it works
  5. Commit and submit a pull request

To develop continuously on Workbench:

  1. Check this code out in a sibling directory to your checked-out Workbench code
  2. Start Workbench with bin/dev start
  3. In a separate tab in the Workbench directory, run bin/dev develop-module transpose
  4. Edit this code; the module will be reloaded in Workbench immediately