Mercurial > hg > numerics
diff numerics/manipulate.py @ 110:5790bcb30bd8
moar stubbin
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 15 Mar 2015 15:28:15 -0700 |
parents | bad50c6bb243 |
children | c4d26ef63d8e |
line wrap: on
line diff
--- a/numerics/manipulate.py Sun Mar 15 10:49:29 2015 -0700 +++ b/numerics/manipulate.py Sun Mar 15 15:28:15 2015 -0700 @@ -10,12 +10,12 @@ import os import sys from .convert import default_cast, cast_columns +from .data import transpose from .read import CSVParser # module globals __all__ = ['ManipulationParser', 'main'] -here = os.path.dirname(os.path.realpath(__file__)) -string = (str, unicode) + class ManipulationParser(CSVParser): """CLI option parser for data manipulation""" @@ -29,7 +29,10 @@ def typed_data(self): """return parsed and casted data""" - raise NotImplementedError('TODO') # -> record TODO items + return cast_columns(self.columns(), self.types) + + def process(self): + return transpose(self.typed_data()) def main(args=sys.argv[1:]): """CLI""" @@ -38,5 +41,8 @@ parser = ManipulationParser() options = parser.parse_args(args) + # write manipulated data + parser.write(parser.process()) + if __name__ == '__main__': main()