| 1 |
===== |
| 2 |
csvpy |
| 3 |
===== |
| 4 |
|
| 5 |
Description |
| 6 |
=========== |
| 7 |
|
| 8 |
Loads a CSV file into a :class:`agate.csv.Reader` object and then drops into a Python shell so the user can inspect the data however they see fit: |
| 9 |
|
| 10 |
.. code-block:: none |
| 11 |
|
| 12 |
usage: csvpy [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b] |
| 13 |
[-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING] [-L LOCALE] |
| 14 |
[-S] [--blanks] [--null-value NULL_VALUES [NULL_VALUES ...]] |
| 15 |
[--date-format DATE_FORMAT] [--datetime-format DATETIME_FORMAT] |
| 16 |
[-H] [-K SKIP_LINES] [-v] [-l] [--zero] [-V] [--dict] [--agate] |
| 17 |
[--no-number-ellipsis] [-y SNIFF_LIMIT] [-I] |
| 18 |
[FILE] |
| 19 |
|
| 20 |
Load a CSV file into a CSV reader and then drop into a Python shell. |
| 21 |
|
| 22 |
positional arguments: |
| 23 |
FILE The CSV file to operate on. If omitted, will accept |
| 24 |
input as piped data via STDIN. |
| 25 |
|
| 26 |
optional arguments: |
| 27 |
-h, --help show this help message and exit |
| 28 |
--dict Load the CSV file into a DictReader. |
| 29 |
--agate Load the CSV file into an agate table. |
| 30 |
--no-number-ellipsis Disable the ellipsis if the max precision is exceeded. |
| 31 |
-y SNIFF_LIMIT, --snifflimit SNIFF_LIMIT |
| 32 |
Limit CSV dialect sniffing to the specified number of |
| 33 |
bytes. Specify "0" to disable sniffing entirely, or |
| 34 |
"-1" to sniff the entire file. |
| 35 |
-I, --no-inference Disable type inference (and --locale, --date-format, |
| 36 |
--datetime-format, --no-leading-zeroes) when parsing |
| 37 |
the input. |
| 38 |
|
| 39 |
This tool will automatically use the IPython shell if it is installed, otherwise it will use the running Python shell. |
| 40 |
|
| 41 |
.. note:: |
| 42 |
|
| 43 |
Due to platform limitations, csvpy does not accept file input as piped data via STDIN. |
| 44 |
|
| 45 |
See also: :doc:`../common_arguments`. |
| 46 |
|
| 47 |
Examples |
| 48 |
======== |
| 49 |
|
| 50 |
Basic use: |
| 51 |
|
| 52 |
.. code-block:: console |
| 53 |
|
| 54 |
$ csvpy examples/dummy.csv |
| 55 |
Welcome! "examples/dummy.csv" has been loaded in a reader object named "reader". |
| 56 |
>>> next(reader) |
| 57 |
['a', 'b', 'c'] |
| 58 |
|
| 59 |
As a dictionary: |
| 60 |
|
| 61 |
.. code-block:: console |
| 62 |
|
| 63 |
$ csvpy --dict examples/dummy.csv |
| 64 |
Welcome! "examples/dummy.csv" has been loaded in a DictReader object named "reader". |
| 65 |
>>> next(reader) |
| 66 |
{'a': '1', 'c': '3', 'b': '2'} |
| 67 |
|
| 68 |
As an agate table: |
| 69 |
|
| 70 |
.. code-block:: console |
| 71 |
|
| 72 |
$ csvpy --agate examples/dummy.csv |
| 73 |
Welcome! "examples/dummy.csv" has been loaded in a from_csv object named "reader". |
| 74 |
>>> reader.print_table() |
| 75 |
| a | b | c | |
| 76 |
| ---- | - | - | |
| 77 |
| True | 2 | 3 | |