Skip to content

Commit

Permalink
modify _parser_params
Browse files Browse the repository at this point in the history
  • Loading branch information
thoo committed Nov 19, 2018
1 parent 689a395 commit 233e4ef
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions pandas/io/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,16 @@
By file-like object, we refer to objects with a ``read()`` method, such as
a file handler (e.g. via builtin ``open`` function) or ``StringIO``.
{sep_doc}
sep : str, default {_default_sep}
Delimiter to use. If sep is None, the C engine cannot automatically detect
the separator, but the Python parsing engine can, meaning the latter will
be used and automatically detect the separator by Python's builtin sniffer
tool, ``csv.Sniffer``. In addition, separators longer than 1 character and
different from ``'\s+'`` will be interpreted as regular expressions and
will also force the use of the Python parsing engine. Note that regex
delimiters are prone to ignoring quoted data. Regex example: ``'\r\t'``.
delimiter : str, default ``None``
Alias for sep.
header : int or list of ints, default 'infer'
Row number(s) to use as the column names, and the start of the
data. Default behavior is to infer the column names: if no names
Expand Down Expand Up @@ -130,7 +139,9 @@
to preserve and not interpret dtype.
If converters are specified, they will be applied INSTEAD
of dtype conversion.
{engine_doc}
engine : {{'c', 'python'}}, optional
Parser engine to use. The C engine is faster while the python engine is
currently more feature-complete.
converters : dict, default None
Dict of functions for converting values in certain columns. Keys can either
be integers or column labels.
Expand Down Expand Up @@ -326,23 +337,6 @@
>>> pd.{func_name}('data.csv') # doctest: +SKIP
"""

# engine is not used in read_fwf() so is factored out of the shared docstring
_engine_doc = """engine : {'c', 'python'}, optional
Parser engine to use. The C engine is faster while the python engine is
currently more feature-complete."""

_sep_doc = r"""sep : str, default {default}
Delimiter to use. If sep is None, the C engine cannot automatically detect
the separator, but the Python parsing engine can, meaning the latter will
be used and automatically detect the separator by Python's builtin sniffer
tool, ``csv.Sniffer``. In addition, separators longer than 1 character and
different from ``'\s+'`` will be interpreted as regular expressions and
will also force the use of the Python parsing engine. Note that regex
delimiters are prone to ignoring quoted data. Regex example: ``'\r\t'``.
delimiter : str, default ``None``
Alias for sep.
"""


def _validate_integer(name, val, min_val=0):
"""
Expand Down Expand Up @@ -710,8 +704,7 @@ def parser_f(filepath_or_buffer,
func_name='read_csv',
summary=('Read a comma-separated values (csv) file '
'into DataFrame.'),
sep_doc=_sep_doc.format(default="','"),
engine_doc=_engine_doc)
_default_sep="','")
)(read_csv)

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


Expand Down

0 comments on commit 233e4ef

Please sign in to comment.