Skip to content

Commit fee3211

Browse files
committed
fixup post merge
1 parent 92e0608 commit fee3211

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

doc/source/whatsnew/v1.3.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ Deprecations
648648
- Deprecated setting :attr:`Categorical._codes`, create a new :class:`Categorical` with the desired codes instead (:issue:`40606`)
649649
- 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`)
650650
- Deprecated using ``usecols`` with out of bounds indices for ``read_csv`` with ``engine="c"`` (:issue:`25623`)
651-
- Deprecated passing arguments as positional (except for ``by``) in :meth:`DataFrame.sort_values` and :meth:`Series.sort_values` (:issue:`41485`)
651+
- Deprecated passing arguments as positional in :meth:`DataFrame.sort_values` (except for ``by``) and :meth:`Series.sort_values` (:issue:`41485`)
652652

653653
.. ---------------------------------------------------------------------------
654654

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6227,7 +6227,7 @@ def f(vals) -> tuple[np.ndarray, int]:
62276227
# ----------------------------------------------------------------------
62286228
# Sorting
62296229
# TODO: Just move the sort_values doc here.
6230-
@deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self", "by"])
6230+
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "by"])
62316231
@Substitution(**_shared_doc_kwargs)
62326232
@Appender(NDFrame.sort_values.__doc__)
62336233
# error: Signature of "sort_values" incompatible with supertype "NDFrame"

pandas/core/series.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3225,7 +3225,7 @@ def update(self, other) -> None:
32253225
# ----------------------------------------------------------------------
32263226
# Reindexing, sorting
32273227

3228-
@deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self"])
3228+
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
32293229
def sort_values(
32303230
self,
32313231
axis=0,

pandas/tests/frame/methods/test_sort_values.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -861,8 +861,10 @@ def test_sort_values_pos_args_deprecation(self):
861861
# https://github.com/pandas-dev/pandas/issues/41485
862862
df = DataFrame({"a": [1, 2, 3]})
863863
msg = (
864-
r"Starting with Pandas version 2\.0 all arguments of sort_values except "
865-
r"for the arguments 'self' and 'by' will be keyword-only"
864+
r"In a future version of pandas all arguments of DataFrame\.sort_values "
865+
r"except for the argument 'by' will be keyword-only"
866866
)
867867
with tm.assert_produces_warning(FutureWarning, match=msg):
868-
df.sort_values("a", 0)
868+
result = df.sort_values("a", 0)
869+
expected = DataFrame({"a": [1, 2, 3]})
870+
tm.assert_frame_equal(result, expected)

pandas/tests/series/methods/test_sort_values.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,13 @@ def test_sort_values_pos_args_deprecation(self):
191191
# https://github.com/pandas-dev/pandas/issues/41485
192192
ser = Series([1, 2, 3])
193193
msg = (
194-
r"Starting with Pandas version 2\.0 all arguments of sort_values except "
195-
r"for the argument 'self' will be keyword-only"
194+
r"In a future version of pandas all arguments of Series\.sort_values "
195+
r"will be keyword-only"
196196
)
197197
with tm.assert_produces_warning(FutureWarning, match=msg):
198-
ser.sort_values(0)
198+
result = ser.sort_values(0)
199+
expected = Series([1, 2, 3])
200+
tm.assert_series_equal(result, expected)
199201

200202

201203
class TestSeriesSortingKey:

0 commit comments

Comments
 (0)