csvkit
csvkit copied to clipboard
Add option for the columns names if --no-header-row is used
Currently if I use csvlook --no-header-row
, it will generate alphabet sequence. However the sequence is generated in the way that it is super long for many columns. Let's say if the file have 500 columns. It will generate:
a, b, ..., y, z, aa, bb, cc, ... , yy, zz, aaa, bbb, ... , yyy, zzz, aaaa, bbbb, ...
In the last column, the column header will be like ggggggggggggggggggg. That is crazily long. And it is useless because I can't tell difference between ggggggggggggggggggg (500) and ggggggggggggggggg (474) easily.
Why not give the csvlook
an option to choose from different naming methods? For example, we can provide more compact naming (just like Excel, a, b, ..., y, z, aa, ab, ac, ..., az, ba, ...). Or just simple plain number sequence (e.g. col1, col2, col3...). I would suggest to be --default-header-format=default
, --default-header-format=excel
and --default-header-format=number
I created an upstream issue. If it's resolved, I can add the following option:
self.argparser.add_argument('--default-header-format', dest='default_header_format', choices=['default', 'excel'],
help='If --no-header-row is set, specify the default header format as "default" (a,b,c,...,aa,bb,cc,....) or "excel" (A,B,C,...,AA,AB,AC,...).')
~~https://github.com/wireservice/agate/issues/724~~