Skip to content

Commit d530525

Browse files
authored
DOC: Typo in docs for na_values parameter in pandas.read_csv function #59314 (#59318)
* fixed formatting of default na values * bug fix * fixing docstring formatting * fixing formatting for quoting
1 parent 7ee1091 commit d530525

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pandas/io/parsers/readers.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ class _read_shared(TypedDict, Generic[HashableT], total=False):
142142
_read_shared = dict
143143

144144

145-
_doc_read_csv_and_table = (
146-
r"""
145+
_doc_read_csv_and_table = r"""
147146
{summary}
148147
149148
Also supports optionally iterating or breaking of the file
@@ -272,10 +271,7 @@ class _read_shared(TypedDict, Generic[HashableT], total=False):
272271
na_values : Hashable, Iterable of Hashable or dict of {{Hashable : Iterable}}, optional
273272
Additional strings to recognize as ``NA``/``NaN``. If ``dict`` passed, specific
274273
per-column ``NA`` values. By default the following values are interpreted as
275-
``NaN``: " """
276-
+ fill('", "'.join(sorted(STR_NA_VALUES)), 70, subsequent_indent=" ")
277-
+ """ ".
278-
274+
``NaN``: "{na_values_str}".
279275
keep_default_na : bool, default True
280276
Whether or not to include the default ``NaN`` values when parsing the data.
281277
Depending on whether ``na_values`` is passed in, the behavior is as follows:
@@ -357,8 +353,7 @@ class _read_shared(TypedDict, Generic[HashableT], total=False):
357353
quotechar : str (length 1), optional
358354
Character used to denote the start and end of a quoted item. Quoted
359355
items can include the ``delimiter`` and it will be ignored.
360-
quoting : {{0 or csv.QUOTE_MINIMAL, 1 or csv.QUOTE_ALL, 2 or csv.QUOTE_NONNUMERIC, \
361-
3 or csv.QUOTE_NONE}}, default csv.QUOTE_MINIMAL
356+
quoting : {{0 or csv.QUOTE_MINIMAL, 1 or csv.QUOTE_ALL, 2 or csv.QUOTE_NONNUMERIC, 3 or csv.QUOTE_NONE}}, default csv.QUOTE_MINIMAL
362357
Control field quoting behavior per ``csv.QUOTE_*`` constants. Default is
363358
``csv.QUOTE_MINIMAL`` (i.e., 0) which implies that only fields containing special
364359
characters are quoted (e.g., characters defined in ``quotechar``, ``delimiter``,
@@ -544,8 +539,7 @@ class _read_shared(TypedDict, Generic[HashableT], total=False):
544539
col 2 datetime64[ns]
545540
col 3 datetime64[ns]
546541
dtype: object
547-
"""
548-
)
542+
""" # noqa: E501
549543

550544

551545
class _C_Parser_Defaults(TypedDict):
@@ -756,6 +750,9 @@ def read_csv(
756750
summary="Read a comma-separated values (csv) file into DataFrame.",
757751
see_also_func_name="read_table",
758752
see_also_func_summary="Read general delimited file into DataFrame.",
753+
na_values_str=fill(
754+
'", "'.join(sorted(STR_NA_VALUES)), 70, subsequent_indent=" "
755+
),
759756
_default_sep="','",
760757
storage_options=_shared_docs["storage_options"],
761758
decompression_options=_shared_docs["decompression_options"]
@@ -888,6 +885,9 @@ def read_table(
888885
see_also_func_summary=(
889886
"Read a comma-separated values (csv) file into DataFrame."
890887
),
888+
na_values_str=fill(
889+
'", "'.join(sorted(STR_NA_VALUES)), 70, subsequent_indent=" "
890+
),
891891
_default_sep=r"'\\t' (tab-stop)",
892892
storage_options=_shared_docs["storage_options"],
893893
decompression_options=_shared_docs["decompression_options"]

0 commit comments

Comments
 (0)