Skip to content

Commit f9ecd53

Browse files
authored
REGR: find_stack_level reverts (#44753)
1 parent ad90384 commit f9ecd53

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

pandas/core/arrays/categorical.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ def set_categories(
940940
"a future version. Removing unused categories will always "
941941
"return a new Categorical object.",
942942
FutureWarning,
943-
stacklevel=find_stack_level(),
943+
stacklevel=2,
944944
)
945945
else:
946946
inplace = False

pandas/core/indexes/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7016,7 +7016,7 @@ def _maybe_cast_data_without_dtype(
70167016
"In a future version, the Index constructor will not infer numeric "
70177017
"dtypes when passed object-dtype sequences (matching Series behavior)",
70187018
FutureWarning,
7019-
stacklevel=find_stack_level(),
7019+
stacklevel=3,
70207020
)
70217021
if result.dtype.kind in ["b", "c"]:
70227022
return subarr

pandas/tests/frame/indexing/test_setitem.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ def test_setitem_mask_categorical(self):
947947
df = DataFrame({"cats": catsf, "values": valuesf}, index=idxf)
948948

949949
exp_fancy = exp_multi_row.copy()
950-
with tm.assert_produces_warning(FutureWarning):
950+
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
951951
# issue #37643 inplace kwarg deprecated
952952
return_value = exp_fancy["cats"].cat.set_categories(
953953
["a", "b", "c"], inplace=True

pandas/tests/series/accessors/test_cat_accessor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_cat_accessor(self):
5151

5252
exp = Categorical(["a", "b", np.nan, "a"], categories=["b", "a"])
5353

54-
with tm.assert_produces_warning(FutureWarning):
54+
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
5555
# issue #37643 inplace kwarg deprecated
5656
return_value = ser.cat.set_categories(["b", "a"], inplace=True)
5757

0 commit comments

Comments
 (0)