Skip to content

Commit fb33cb5

Browse files
committed
docs: Document how to handle long rows, #1237
1 parent c6265f4 commit fb33cb5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/scripts/csvclean.rst

+8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ Cleans a CSV file of common syntax errors:
5252
1,Alice,
5353
2,Bob,CA
5454
55+
.. tip::
56+
57+
:doc:`csvcut` without options also adds missing delimiters!
58+
5559
To change the value used to fill short rows, use :code:`--fillvalue`. For example, with :code:`--fillvalue "US"`:
5660

5761
.. code-block:: none
@@ -117,6 +121,10 @@ Test a file with known bad rows:
117121
1,"Expected 3 columns, found 4 columns",1,27,,I'm too long!
118122
2,"Expected 3 columns, found 2 columns",,I'm too short!
119123
124+
.. note::
125+
126+
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.
127+
120128
To change the line ending from line feed (LF or ``\n``) to carriage return and line feed (CRLF or ``\r\n``) use:
121129

122130
.. code-block:: bash

0 commit comments

Comments
 (0)