|
53 | 53 | # so we need to remove it if we see it.
|
54 | 54 | _BOM = u('\ufeff')
|
55 | 55 |
|
56 |
| -_parser_params = r"""{summary} |
| 56 | +_parser_params = r""" |
| 57 | +{summary} |
57 | 58 |
|
58 | 59 | Also supports optionally iterating or breaking of the file
|
59 | 60 | into chunks.
|
|
325 | 326 | >>> pd.{func_name}('data.csv') # doctest: +SKIP
|
326 | 327 | """
|
327 | 328 |
|
328 |
| -# Summary line for read_csv,read_table and read_fwf |
329 |
| -_summary_read_csv = """ |
330 |
| -Read a comma-separated values (csv) file into DataFrame.""" |
331 |
| - |
332 |
| -_summary_read_table = """ |
333 |
| -Read general delimited file into DataFrame. |
334 |
| -
|
335 |
| -.. deprecated:: 0.24.0 |
336 |
| - Use :func:`pandas.read_csv` instead, passing ``sep='\t'`` if necessary.""" |
337 |
| - |
338 |
| -_summary_read_fwf = """ |
339 |
| -Read a table of fixed-width formatted lines into DataFrame.""" |
340 |
| - |
341 | 329 | # engine is not used in read_fwf() so is factored out of the shared docstring
|
342 | 330 | _engine_doc = """engine : {'c', 'python'}, optional
|
343 | 331 | Parser engine to use. The C engine is faster while the python engine is
|
|
355 | 343 | Alias for sep.
|
356 | 344 | """
|
357 | 345 |
|
358 |
| -_read_csv_doc = (_parser_params |
359 |
| - .format(summary=_summary_read_csv, |
360 |
| - sep_doc=_sep_doc.format(default="','"), |
361 |
| - engine_doc=_engine_doc, |
362 |
| - func_name='read_csv')) |
363 |
| - |
364 |
| -_read_table_doc = (_parser_params |
365 |
| - .format(summary=_summary_read_table, |
366 |
| - sep_doc=_sep_doc.format(default="\\t (tab-stop)"), |
367 |
| - engine_doc=_engine_doc, |
368 |
| - func_name='read_table')) |
369 |
| - |
370 | 346 | _fwf_widths = """\
|
371 | 347 | colspecs : list of pairs (int, int) or 'infer'. optional
|
372 | 348 | A list of pairs (tuples) giving the extents of the fixed-width
|
|
383 | 359 | if it is not spaces (e.g., '~').
|
384 | 360 | """
|
385 | 361 |
|
386 |
| -_read_fwf_doc = (_parser_params |
387 |
| - .format(summary=_summary_read_fwf, |
388 |
| - sep_doc='', |
389 |
| - engine_doc='', |
390 |
| - func_name='read_fwf')) |
391 |
| - |
392 | 362 |
|
393 | 363 | def _validate_integer(name, val, min_val=0):
|
394 | 364 | """
|
@@ -734,13 +704,32 @@ def parser_f(filepath_or_buffer,
|
734 | 704 |
|
735 | 705 |
|
736 | 706 | read_csv = _make_parser_function('read_csv', default_sep=',')
|
737 |
| -read_csv = Appender(_read_csv_doc)(read_csv) |
| 707 | +read_csv = Appender(_parser_params.format( |
| 708 | + func_name='read_csv', |
| 709 | + summary=('Read a comma-separated values (csv) file ' |
| 710 | + 'into DataFrame.'), |
| 711 | + sep_doc=_sep_doc.format(default="','"), |
| 712 | + engine_doc=_engine_doc) |
| 713 | + )(read_csv) |
738 | 714 |
|
739 | 715 | read_table = _make_parser_function('read_table', default_sep='\t')
|
740 |
| -read_table = Appender(_read_table_doc)(read_table) |
| 716 | +read_table = Appender(_parser_params.format( |
| 717 | + func_name='read_table', |
| 718 | + summary="""Read general delimited file into DataFrame. |
741 | 719 |
|
742 |
| - |
743 |
| -@Appender(_read_fwf_doc) |
| 720 | +.. deprecated:: 0.24.0 |
| 721 | +Use :func:`pandas.read_csv` instead, passing ``sep='\\t'`` if necessary.""", |
| 722 | + sep_doc=_sep_doc.format(default="\\t (tab-stop)"), |
| 723 | + engine_doc=_engine_doc) |
| 724 | + )(read_table) |
| 725 | + |
| 726 | + |
| 727 | +@Appender(_parser_params.format( |
| 728 | + func_name='read_fwf', |
| 729 | + summary=('Read a table of fixed-width formatted lines ' |
| 730 | + 'into DataFrame.'), |
| 731 | + sep_doc='', |
| 732 | + engine_doc='')) |
744 | 733 | def read_fwf(filepath_or_buffer, colspecs='infer', widths=None, **kwds):
|
745 | 734 | # Check input arguments.
|
746 | 735 | if colspecs is None and widths is None:
|
|
0 commit comments