Created by: ewheeler
commit includes example data and example functions file
not sure if this is generally useful, but i find this handy for quick conversions or cleanups that fall outside of the realm of csvclean
and are not so complicated that i'd want to write a one-off script (e.g., convert timestamp formatting or remove punctuation)
the idea is to create a python file with functions corresponding to column names. these functions are called for each cell in the corresponding column, and the result returned by the function replaces the original cell value. since column names can have spaces and non-ascii characters, csvmap
includes a slugify
function that will output ascii-only versions of column names that can be used as python method names.
calling csvmap with the -s
flag will output these slugified versions
$ csvmap -s examples/csvmap_example_input.csv
1: timestamp_created
2: companys_name
and then call csvmap with the -m
option giving the path to the python file
$ csvmap -m examples/csvmap_example_mapfile.py examples/csvmap_example_input.csv