Reference

csvpy(1)

csvpy Documentation

NAME

csvpy - csvpy Documentation

DESCRIPTION

Loads a CSV file into a agate.csv.Reader object and then drops into a Python shell so the user can inspect the data however they see fit:

usage: csvpy [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b]
             [-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING] [-L LOCALE]
             [-S] [--blanks] [--null-value NULL_VALUES [NULL_VALUES ...]]
             [--date-format DATE_FORMAT] [--datetime-format DATETIME_FORMAT]
             [-H] [-K SKIP_LINES] [-v] [-l] [--zero] [-V] [--dict] [--agate]
             [--no-number-ellipsis] [-y SNIFF_LIMIT] [-I]
             [FILE]
Load a CSV file into a CSV reader and then drop into a Python shell.
positional arguments:
  FILE                  The CSV file to operate on. If omitted, will accept
                        input as piped data via STDIN.
optional arguments:
  -h, --help            show this help message and exit
  --dict                Load the CSV file into a DictReader.
  --agate               Load the CSV file into an agate table.
  --no-number-ellipsis  Disable the ellipsis if the max precision is exceeded.
  -y SNIFF_LIMIT, --snifflimit SNIFF_LIMIT
                        Limit CSV dialect sniffing to the specified number of
                        bytes. Specify "0" to disable sniffing entirely, or
                        "-1" to sniff the entire file.
  -I, --no-inference    Disable type inference (and --locale, --date-format,
                        --datetime-format, --no-leading-zeroes) when parsing
                        the input.

This tool will automatically use the IPython shell if it is installed, otherwise it will use the running Python shell.

NOTE:

Due to platform limitations, csvpy does not accept file input as piped data via STDIN.

See also: Arguments common to all tools.

EXAMPLES

Basic use:


        
    

$ csvpy examples/dummy.csv

Welcome! "examples/dummy.csv" has been loaded in a reader object named "reader". >>> next(reader) ['a', 'b', 'c']

As a dictionary:

$ csvpy --dict examples/dummy.csv
Welcome! "examples/dummy.csv" has been loaded in a DictReader object named "reader".
>>> next(reader)
{'a': '1', 'c': '3', 'b': '2'}

As an agate table:

$ csvpy --agate examples/dummy.csv
Welcome! "examples/dummy.csv" has been loaded in a from_csv object named "reader".
>>> reader.print_table()
|    a | b | c |
| ---- | - | - |
| True | 2 | 3 |

AUTHOR

Christopher Groskopf and contributors

COPYRIGHT

2016, Christopher Groskopf and James McKinney

History

--agate until Debian 12 (Bookworm); --blanks until Debian 12 (Bookworm); --date-format until Debian 12 (Bookworm); --datetime-format until Debian 12 (Bookworm); --delimiter until Debian 12 (Bookworm); --dict until Debian 12 (Bookworm); --encoding until Debian 12 (Bookworm); --escapechar until Debian 12 (Bookworm); --help until Debian 12 (Bookworm); --linenumbers until Debian 12 (Bookworm); --locale until Debian 12 (Bookworm); --maxfieldsize until Debian 12 (Bookworm); --no-doublequote until Debian 12 (Bookworm); --no-header-row until Debian 12 (Bookworm); --quotechar until Debian 12 (Bookworm); --quoting until Debian 12 (Bookworm); --skip-lines until Debian 12 (Bookworm); --skipinitialspace until Debian 12 (Bookworm); --tabs until Debian 12 (Bookworm); --verbose until Debian 12 (Bookworm); --version until Debian 12 (Bookworm); --zero until Debian 12 (Bookworm); -H until Debian 12 (Bookworm); -K until Debian 12 (Bookworm); -L until Debian 12 (Bookworm); -S until Debian 12 (Bookworm); -V until Debian 12 (Bookworm); -b until Debian 12 (Bookworm); -d until Debian 12 (Bookworm); -e until Debian 12 (Bookworm); -h until Debian 12 (Bookworm); -l until Debian 12 (Bookworm); -p until Debian 12 (Bookworm); -q until Debian 12 (Bookworm); -t until Debian 12 (Bookworm); -u until Debian 12 (Bookworm); -v until Debian 12 (Bookworm); -z until Debian 12 (Bookworm).