Skip to content

Commit bf0d412

Browse files
[3.14] gh-74232: Add a note about roundtrip of non-float numerics in CSV (GH-134963) (GH-135048)
(cherry picked from commit e814f43) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent 428b0ca commit bf0d412

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Doc/library/csv.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ The :mod:`csv` module defines the following functions:
7070
section :ref:`csv-fmt-params`.
7171

7272
Each row read from the csv file is returned as a list of strings. No
73-
automatic data type conversion is performed unless the ``QUOTE_NONNUMERIC`` format
73+
automatic data type conversion is performed unless the :data:`QUOTE_NONNUMERIC` format
7474
option is specified (in which case unquoted fields are transformed into floats).
7575

7676
A short usage example::
@@ -331,8 +331,14 @@ The :mod:`csv` module defines the following constants:
331331

332332
Instructs :class:`writer` objects to quote all non-numeric fields.
333333

334-
Instructs :class:`reader` objects to convert all non-quoted fields to type *float*.
334+
Instructs :class:`reader` objects to convert all non-quoted fields to type :class:`float`.
335335

336+
.. note::
337+
Some numeric types, such as :class:`bool`, :class:`~fractions.Fraction`,
338+
or :class:`~enum.IntEnum`, have a string representation that cannot be
339+
converted to :class:`float`.
340+
They cannot be read in the :data:`QUOTE_NONNUMERIC` and
341+
:data:`QUOTE_STRINGS` modes.
336342

337343
.. data:: QUOTE_NONE
338344

0 commit comments

Comments
 (0)