# HG changeset patch
# User Jeff Hammel <k0scist@gmail.com>
# Date 1426438968 25200
# Node ID 19a5c2fb52bb8ed1b78e7e4e83bbbc9a45c374c5
# Parent  895ad896023a11b44db32e972128c9fd9a167777
add transpose functionality

diff -r 895ad896023a -r 19a5c2fb52bb numerics/bar.py
--- a/numerics/bar.py	Sun Mar 15 09:54:13 2015 -0700
+++ b/numerics/bar.py	Sun Mar 15 10:02:48 2015 -0700
@@ -19,7 +19,7 @@
 from bokeh.plotting import *
 from collections import OrderedDict
 
-__all__ = ['bar_chart', 'main']
+__all__ = ['bar_chart', 'BarChartParser', 'main']
 
 def bar_chart(data, output, title=None):
     """create a bar chart"""
@@ -29,6 +29,7 @@
     bar.width(len(data)*50)
     bar.show()
 
+
 class BarChartParser(CSVParser):
     """command line options parser for bar charts"""
     # TODO: upstream to PlotParser
diff -r 895ad896023a -r 19a5c2fb52bb numerics/convert.py
--- a/numerics/convert.py	Sun Mar 15 09:54:13 2015 -0700
+++ b/numerics/convert.py	Sun Mar 15 10:02:48 2015 -0700
@@ -11,7 +11,8 @@
 from .data import transpose
 from .read import read_csv, CSVParser
 
-__all__ = ['cast',
+__all__ = ['default_cast',
+           'cast',
            'float_or_orig',
            'main']
 
diff -r 895ad896023a -r 19a5c2fb52bb numerics/manipulate.py
--- a/numerics/manipulate.py	Sun Mar 15 09:54:13 2015 -0700
+++ b/numerics/manipulate.py	Sun Mar 15 10:02:48 2015 -0700
@@ -37,4 +37,3 @@
 
 if __name__ == '__main__':
     main()
-
diff -r 895ad896023a -r 19a5c2fb52bb numerics/read.py
--- a/numerics/read.py	Sun Mar 15 09:54:13 2015 -0700
+++ b/numerics/read.py	Sun Mar 15 10:02:48 2015 -0700
@@ -12,6 +12,7 @@
 import csv
 import os
 import sys
+from .data import transpose
 from .write import CSVWriter
 
 # module globals
@@ -145,7 +146,7 @@
 
     def columns(self):
         """return columns vs `data`'s rows"""
-        raise NotImplementedError('TODO') # -> record TODO items
+        return transpose(self.read())
 
 
 def main(args=sys.argv[1:]):
@@ -153,6 +154,9 @@
 
     # parse command line options
     parser = CSVParser()
+    parser.add_argument('--transpose', dest='transpose',
+                        action='store_true', default=False,
+                        help="transpose columns and rows")
     options = parser.parse_args(args)
 
     if not options.csv:
@@ -160,7 +164,10 @@
         options.csv = [sys.stdin]
 
     # read CSV
-    data = parser.read()
+    if options.transpose:
+        data = parser.columns()
+    else:
+        data = parser.read()
 
     # write CSV
     writer = CSVWriter(options.output)