Skip to content

Commit 2e18f91

Browse files
committed
CLN: Deprecate non-keyword arguments in read_table pandas-dev#41485
1 parent a811c96 commit 2e18f91

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

doc/source/whatsnew/v1.3.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ Deprecations
700700
- Deprecated passing arguments as positional in :meth:`DataFrame.where` and :meth:`Series.where` (other than ``"cond"`` and ``"other"``) (:issue:`41485`)
701701
- Deprecated passing arguments as positional (other than ``filepath_or_buffer``) in :func:`read_csv` (:issue:`41485`)
702702
- Deprecated passing arguments as positional in :meth:`DataFrame.drop` (other than ``"labels"``) and :meth:`Series.drop` (:issue:`41485`)
703-
-
703+
- Deprecated passing arguments as positional (other than ``filepath_or_buffer``) in :func:`read_table` (:issue:`41485`)
704704

705705

706706
.. _whatsnew_130.deprecations.nuisance_columns:

pandas/io/parsers/readers.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,9 @@ def read_csv(
591591

592592
return _read(filepath_or_buffer, kwds)
593593

594-
594+
@deprecate_nonkeyword_arguments(
595+
version=None, allowed_args=["filepath_or_buffer"], stacklevel=3
596+
)
595597
@Appender(
596598
_doc_read_csv_and_table.format(
597599
func_name="read_table",

pandas/tests/io/parser/common/test_common_basic.py

+11
Original file line numberDiff line numberDiff line change
@@ -823,3 +823,14 @@ def test_malformed_second_line(all_parsers):
823823
result = parser.read_csv(StringIO(data), skip_blank_lines=False, header=1)
824824
expected = DataFrame({"a": ["b"]})
825825
tm.assert_frame_equal(result, expected)
826+
827+
def test_read_table_posargs_deprecation(all_parsers):
828+
# https://github.com/pandas-dev/pandas/issues/41485
829+
f = StringIO("a\tb\n1\t2")
830+
parser = all_parsers
831+
msg = (
832+
"In a future version of pandas all arguments of read_table "
833+
"except for the argument 'filepath_or_buffer' will be keyword-only"
834+
)
835+
with tm.assert_produces_warning(FutureWarning, match=msg):
836+
parser.read_table(f, " ")

0 commit comments

Comments
 (0)