Skip to content

Commit

Permalink
DEPR: pd.read_table
Browse files Browse the repository at this point in the history
- pd.read_table is deprecated and replaced by pd.read_csv.
- added whatsnew note
  • Loading branch information
dahlbaek committed Jul 17, 2018
1 parent 537b65c commit 4f41cd0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.24.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ Deprecations
- :meth:`DataFrame.to_stata`, :meth:`read_stata`, :class:`StataReader` and :class:`StataWriter` have deprecated the ``encoding`` argument. The encoding of a Stata dta file is determined by the file type and cannot be changed (:issue:`21244`).
- :meth:`MultiIndex.to_hierarchical` is deprecated and will be removed in a future version (:issue:`21613`)
- :meth:`Series.ptp` is deprecated. Use ``numpy.ptp`` instead (:issue:`21614`)
- :func:`pandas.read_table` is deprecated. Use ``pandas.read_csv`` instead (:issue:`21948`)
-

.. _whatsnew_0240.prior_deprecations:
Expand Down
16 changes: 15 additions & 1 deletion pandas/io/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@
""" % (_parser_params % (_sep_doc.format(default="','"), _engine_doc))

_read_table_doc = """
.. deprecated:: 0.24.0
Use :func:`pandas.read_csv` instead, passing `sep='\t'` if necessary.
Read general delimited file into DataFrame
%s
Expand Down Expand Up @@ -606,6 +610,16 @@ def parser_f(filepath_or_buffer,
memory_map=False,
float_precision=None):

if name == "read_table":
if sep == None and delimiter == None:
warnings.warn("read_table is deprecated, use read_csv with "
"sep='\\t' instead.",
FutureWarning, stacklevel=2)
sep = '\t'
else:
warnings.warn("read_table is deprecated, use read_csv instead.",
FutureWarning, stacklevel=2)

# Alias sep -> delimiter.
if delimiter is None:
delimiter = sep
Expand Down Expand Up @@ -685,7 +699,7 @@ def parser_f(filepath_or_buffer,
read_csv = _make_parser_function('read_csv', sep=',')
read_csv = Appender(_read_csv_doc)(read_csv)

read_table = _make_parser_function('read_table', sep='\t')
read_table = _make_parser_function('read_table', sep=None)
read_table = Appender(_read_table_doc)(read_table)


Expand Down

0 comments on commit 4f41cd0

Please sign in to comment.