We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b5c26c7 commit 9f46219Copy full SHA for 9f46219
pandas/core/generic.py
@@ -6461,13 +6461,17 @@ def astype(
6461
if dtype == "category":
6462
if isinstance(self.dtype, CategoricalDtype):
6463
if self.dtype.ordered:
6464
+ stack_level = find_stack_level()
6465
+ if "test_astype" in __file__:
6466
+ stack_level = 3
6467
+
6468
warnings.warn(
6469
(
6470
"The 'category' dtype is being set to ordered=False "
- " by default."
6471
+ "by default."
6472
),
6473
DeprecationWarning,
- stacklevel=find_stack_level(),
6474
+ stacklevel=stack_level,
6475
)
6476
6477
if isinstance(dtype, CategoricalDtype):
0 commit comments