Skip to content

Commit 1082e62

Browse files
committed
deprecate default args as positional in set_axis
1 parent 0d49452 commit 1082e62

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

doc/source/whatsnew/v1.3.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@ Deprecations
647647
- Deprecated setting :attr:`Categorical._codes`, create a new :class:`Categorical` with the desired codes instead (:issue:`40606`)
648648
- Deprecated behavior of :meth:`DatetimeIndex.union` with mixed timezones; in a future version both will be cast to UTC instead of object dtype (:issue:`39328`)
649649
- Deprecated using ``usecols`` with out of bounds indices for ``read_csv`` with ``engine="c"`` (:issue:`25623`)
650+
- Deprecated passing arguments (apart from ``labels``) as positional in :meth:`DataFrame.set_axis` and :meth:`Series.set_axis` (:issue:`41485`)
650651

651652
.. ---------------------------------------------------------------------------
652653

pandas/tests/frame/methods/test_set_axis.py

+8
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,11 @@ def test_nonkeyword_arguments_deprecation_warning():
109109
)
110110
with tm.assert_produces_warning(FutureWarning, match=msg):
111111
df.set_axis([1, 2, 4], False)
112+
113+
ser = Series([1, 2, 3])
114+
msg = (
115+
r"Starting with Pandas version 2\.0 all arguments of set_axis except for the "
116+
r"arguments 'self' and 'labels' will be keyword-only"
117+
)
118+
with tm.assert_produces_warning(FutureWarning, match=msg):
119+
ser.set_axis([1, 2, 4], False)

0 commit comments

Comments
 (0)