Skip to content

[3.13] gh-74232: Add a note about roundtrip of non-float numerics in CSV (GH-134963) #135049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Doc/library/csv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ The :mod:`csv` module defines the following functions:
section :ref:`csv-fmt-params`.

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

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

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

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

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

.. data:: QUOTE_NONE

Expand Down
Loading