You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGELOG.rst
+2
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,8 @@ Other changes:
13
13
14
14
* :code:`--header-normalize-space`, to strip leading and trailing whitespace and replace sequences of whitespace characters by a single space in the header
15
15
* :code:`--separator`, to change the string with which to join short rows
16
+
* :code:`--fill-short-rows`, to fill short rows with the missing cells
17
+
* :code:`--fillvalue`, to change the value with which to fill short rows
16
18
17
19
* feat: The :code:`--quoting` option accepts 4 (`csv.QUOTE_STRINGS <https://docs.python.org/3/library/csv.html#csv.QUOTE_STRINGS>`__) and 5 (`csv.QUOTE_NOTNULL <https://docs.python.org/3/library/csv.html#csv.QUOTE_NOTNULL>`__) on Python 3.12.
18
20
* feat: :doc:`/scripts/csvformat`: The :code:`--out-quoting` option accepts 4 (`csv.QUOTE_STRINGS <https://docs.python.org/3/library/csv.html#csv.QUOTE_STRINGS>`__) and 5 (`csv.QUOTE_NOTNULL <https://docs.python.org/3/library/csv.html#csv.QUOTE_NOTNULL>`__) on Python 3.12.
Copy file name to clipboardexpand all lines: docs/scripts/csvclean.rst
+36
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,30 @@ Cleans a CSV file of common syntax errors:
36
36
1,"1 Main St, Springfield",US
37
37
2,"123 Acadia Avenue, London",GB
38
38
39
+
- If a CSV has missing delimiters, like:
40
+
41
+
.. code-block:: none
42
+
43
+
id,name,country
44
+
1,Alice
45
+
2,Bob,CA
46
+
47
+
You can add the missing delimiters with :code:`--fill-short-rows`:
48
+
49
+
.. code-block:: none
50
+
51
+
id,name,country
52
+
1,Alice,
53
+
2,Bob,CA
54
+
55
+
To change the value used to fill short rows, use :code:`--fillvalue`. For example, with :code:`--fillvalue "US"`:
56
+
57
+
.. code-block:: none
58
+
59
+
id,name,country
60
+
1,Alice,US
61
+
2,Bob,CA
62
+
39
63
All valid rows are written to standard output, and all error rows along with line numbers and descriptions are written to standard error. If there are error rows, the exit code will be 1.
40
64
41
65
.. note::
@@ -63,6 +87,18 @@ All valid rows are written to standard output, and all error rows along with lin
63
87
64
88
optional arguments:
65
89
-h, --help show this help message and exit
90
+
--header-normalize-space
91
+
Strip leading and trailing whitespace and replace
92
+
sequences of whitespace characters by a single space
93
+
in the header.
94
+
--join-short-rows Merges short rows into a single row.
95
+
--separator SEPARATOR
96
+
The string with which to join short rows. Defaults to
97
+
a newline.
98
+
--fill-short-rows Fill short rows with the missing cells.
99
+
--fillvalue FILLVALUE
100
+
The value with which to fill short rows. Defaults to
0 commit comments