Skip to content

Commit 233e4ef

Browse files
committed
modify _parser_params
1 parent 689a395 commit 233e4ef

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

pandas/io/parsers.py

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,16 @@
7474
7575
By file-like object, we refer to objects with a ``read()`` method, such as
7676
a file handler (e.g. via builtin ``open`` function) or ``StringIO``.
77-
{sep_doc}
77+
sep : str, default {_default_sep}
78+
Delimiter to use. If sep is None, the C engine cannot automatically detect
79+
the separator, but the Python parsing engine can, meaning the latter will
80+
be used and automatically detect the separator by Python's builtin sniffer
81+
tool, ``csv.Sniffer``. In addition, separators longer than 1 character and
82+
different from ``'\s+'`` will be interpreted as regular expressions and
83+
will also force the use of the Python parsing engine. Note that regex
84+
delimiters are prone to ignoring quoted data. Regex example: ``'\r\t'``.
85+
delimiter : str, default ``None``
86+
Alias for sep.
7887
header : int or list of ints, default 'infer'
7988
Row number(s) to use as the column names, and the start of the
8089
data. Default behavior is to infer the column names: if no names
@@ -130,7 +139,9 @@
130139
to preserve and not interpret dtype.
131140
If converters are specified, they will be applied INSTEAD
132141
of dtype conversion.
133-
{engine_doc}
142+
engine : {{'c', 'python'}}, optional
143+
Parser engine to use. The C engine is faster while the python engine is
144+
currently more feature-complete.
134145
converters : dict, default None
135146
Dict of functions for converting values in certain columns. Keys can either
136147
be integers or column labels.
@@ -326,23 +337,6 @@
326337
>>> pd.{func_name}('data.csv') # doctest: +SKIP
327338
"""
328339

329-
# engine is not used in read_fwf() so is factored out of the shared docstring
330-
_engine_doc = """engine : {'c', 'python'}, optional
331-
Parser engine to use. The C engine is faster while the python engine is
332-
currently more feature-complete."""
333-
334-
_sep_doc = r"""sep : str, default {default}
335-
Delimiter to use. If sep is None, the C engine cannot automatically detect
336-
the separator, but the Python parsing engine can, meaning the latter will
337-
be used and automatically detect the separator by Python's builtin sniffer
338-
tool, ``csv.Sniffer``. In addition, separators longer than 1 character and
339-
different from ``'\s+'`` will be interpreted as regular expressions and
340-
will also force the use of the Python parsing engine. Note that regex
341-
delimiters are prone to ignoring quoted data. Regex example: ``'\r\t'``.
342-
delimiter : str, default ``None``
343-
Alias for sep.
344-
"""
345-
346340

347341
def _validate_integer(name, val, min_val=0):
348342
"""
@@ -710,8 +704,7 @@ def parser_f(filepath_or_buffer,
710704
func_name='read_csv',
711705
summary=('Read a comma-separated values (csv) file '
712706
'into DataFrame.'),
713-
sep_doc=_sep_doc.format(default="','"),
714-
engine_doc=_engine_doc)
707+
_default_sep="','")
715708
)(read_csv)
716709

717710
read_table = _make_parser_function('read_table', default_sep='\t')
@@ -721,8 +714,7 @@ def parser_f(filepath_or_buffer,
721714
722715
.. deprecated:: 0.24.0
723716
Use :func:`pandas.read_csv` instead, passing ``sep='\\t'`` if necessary.""",
724-
sep_doc=_sep_doc.format(default="\\t (tab-stop)"),
725-
engine_doc=_engine_doc)
717+
_default_sep=r'\\t (tab-stop)')
726718
)(read_table)
727719

728720

0 commit comments

Comments
 (0)