# HG changeset patch # User Jeff Hammel # Date 1426459092 25200 # Node ID c4d26ef63d8ef08d85fbb298a50f65b4e6d44751 # Parent 5790bcb30bd80ee82d1ecf50afb18824444390c9 fix error in convert and i think this works sorta well enouigh for now diff -r 5790bcb30bd8 -r c4d26ef63d8e numerics/convert.py --- a/numerics/convert.py Sun Mar 15 15:28:15 2015 -0700 +++ b/numerics/convert.py Sun Mar 15 15:38:12 2015 -0700 @@ -38,11 +38,18 @@ cast to `to_type` if possible; otherwise just throw away """ - raise NotImplementedError('TODO') # -> record TODO items + retval = [] + for value in values: + try: + retval.append(to_type(value)) + except ValueError: + continue + return retval + def float_or_orig(*values): return cast(float, *values) - + # convenience function ; do we need this? def column_type(values, types=default_cast): """determine the type of a column""" @@ -55,7 +62,6 @@ else: return t - raise NotImplementedError('TODO') # -> record TODO items def cast_columns(columns, types=default_cast): """ @@ -63,8 +69,8 @@ """ column_types = [column_type(column, types=types) for column in columns] - return [[column_type(row) for row in column] - for column_type, column in zip(column_types, columns)] + return [[_type(row) for row in column] + for _type, column in zip(column_types, columns)] def main(args=sys.argv[1:]): diff -r 5790bcb30bd8 -r c4d26ef63d8e numerics/manipulate.py --- a/numerics/manipulate.py Sun Mar 15 15:28:15 2015 -0700 +++ b/numerics/manipulate.py Sun Mar 15 15:38:12 2015 -0700 @@ -34,6 +34,7 @@ def process(self): return transpose(self.typed_data()) + def main(args=sys.argv[1:]): """CLI"""