Skip to content

Commit

Permalink
docs: Document how to handle long rows, #1237
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Apr 28, 2024
1 parent c6265f4 commit fb33cb5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/scripts/csvclean.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ Cleans a CSV file of common syntax errors:
1,Alice,
2,Bob,CA
.. tip::

:doc:`csvcut` without options also adds missing delimiters!

To change the value used to fill short rows, use :code:`--fillvalue`. For example, with :code:`--fillvalue "US"`:

.. code-block:: none
Expand Down Expand Up @@ -117,6 +121,10 @@ Test a file with known bad rows:
1,"Expected 3 columns, found 4 columns",1,27,,I'm too long!
2,"Expected 3 columns, found 2 columns",,I'm too short!
.. note::

If any data rows are longer than the header row, you need to add columns manually: for example, by adding one or more delimiters (``,``) to the end of the header row. :code:`csvclean` can't do this, because it is designed to work with standard input, and correcting an error at the start of the CSV data based on an observation later in the CSV data would require holding all the CSV data in memory – which is not an option for large files.

To change the line ending from line feed (LF or ``\n``) to carriage return and line feed (CRLF or ``\r\n``) use:

.. code-block:: bash
Expand Down

0 comments on commit fb33cb5

Please sign in to comment.