wireservice / csvkit

A suite of utilities for converting to and working with CSV, the king of tabular file formats.
https://csvkit.readthedocs.io
MIT License
5.9k stars 605 forks source link

add more options from csvlook to csvpy #1231

Closed zeweichen closed 4 months ago

zeweichen commented 4 months ago

Consider what happens after running $ csvpy --agate

Inside the Python REPL

table.print_table()

will elide numbers if the actual precision is greater than the default max-precision which is not obvious how to override.

csvpy already has many of the content/output control options as csvlook: --null-value, --date-format, --datetime-format, -H, -K, -l, --zero

It would be more consistent to add a few more options from csvlook: --no-number-ellipsis, --max-precision, --max-width, --max-rows, --max-columns, --max-column-width, --no-inference, --sniff_limit

jpmckinney commented 4 months ago

The csvpy options you mention are about loading the table (input).

Controlling output in the same way would require quite a lot of logic to be added or changed in agate, since these are all keyword arguments to print_table

We can consider:

Not sure where you got --max-width

jpmckinney commented 4 months ago

Ah, unless you mean to have max rows apply as a row limit when reading the input. We can do that - but it's not available on any tool other than csvlook.

jpmckinney commented 4 months ago

Note that --linenumbers and --zero had no effect, and since they control output (and can't be easily passed to agate method calls), I removed them.