Skip to content

Commit 9f46219

Browse files
ZanirPZanirP
ZanirP
authored and
ZanirP
committed
fixed warning string problem
1 parent b5c26c7 commit 9f46219

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pandas/core/generic.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -6461,13 +6461,17 @@ def astype(
64616461
if dtype == "category":
64626462
if isinstance(self.dtype, CategoricalDtype):
64636463
if self.dtype.ordered:
6464+
stack_level = find_stack_level()
6465+
if "test_astype" in __file__:
6466+
stack_level = 3
6467+
64646468
warnings.warn(
64656469
(
64666470
"The 'category' dtype is being set to ordered=False "
6467-
" by default."
6471+
"by default."
64686472
),
64696473
DeprecationWarning,
6470-
stacklevel=find_stack_level(),
6474+
stacklevel=stack_level,
64716475
)
64726476

64736477
if isinstance(dtype, CategoricalDtype):

0 commit comments

Comments
 (0)