Skip to content

Commit 043b609

Browse files
authored
DEPR: deprecate non keyword arguments to read_excel (pandas-dev#34418)
1 parent 83d3c4c commit 043b609

File tree

6 files changed

+246
-163
lines changed

6 files changed

+246
-163
lines changed

doc/source/whatsnew/v1.1.0.rst

+4
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,10 @@ Deprecations
686686
version 1.1. All other arguments should be given as keyword
687687
arguments (:issue:`27573`).
688688

689+
- Passing any arguments but the first 2 to :func:`read_excel` as
690+
positional arguments is deprecated since version 1.1. All other
691+
arguments should be given as keyword arguments (:issue:`27573`).
692+
689693
- :func:`pandas.api.types.is_categorical` is deprecated and will be removed in a future version; use `:func:pandas.api.types.is_categorical_dtype` instead (:issue:`33385`)
690694
- :meth:`Index.get_value` is deprecated and will be removed in a future version (:issue:`19728`)
691695
- :meth:`Series.dt.week` and `Series.dt.weekofyear` are deprecated and will be removed in a future version, use :meth:`Series.dt.isocalendar().week` instead (:issue:`33595`)

pandas/io/excel/_base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from pandas._libs.parsers import STR_NA_VALUES
1010
from pandas.errors import EmptyDataError
11-
from pandas.util._decorators import Appender
11+
from pandas.util._decorators import Appender, deprecate_nonkeyword_arguments
1212

1313
from pandas.core.dtypes.common import is_bool, is_float, is_integer, is_list_like
1414

@@ -266,6 +266,7 @@
266266
)
267267

268268

269+
@deprecate_nonkeyword_arguments(allowed_args=2, version="2.0")
269270
@Appender(_read_excel_doc)
270271
def read_excel(
271272
io,

pandas/tests/io/excel/test_odf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_read_writer_table():
3333
columns=["Column 1", "Unnamed: 2", "Column 3"],
3434
)
3535

36-
result = pd.read_excel("writertable.odt", "Table1", index_col=0)
36+
result = pd.read_excel("writertable.odt", sheet_name="Table1", index_col=0)
3737

3838
tm.assert_frame_equal(result, expected)
3939

0 commit comments

Comments
 (0)