Skip to content

Commit 53a41bb

Browse files
committed
Change warning
1 parent a7c7798 commit 53a41bb

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

pandas/core/arrays/arrow/array.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
pa_version_under12p1,
2929
pa_version_under13p0,
3030
)
31+
from pandas.errors import Pandas4Warning
3132
from pandas.util._decorators import doc
3233
from pandas.util._exceptions import find_stack_level
3334

@@ -930,14 +931,13 @@ def _logical_method(self, other, op) -> Self:
930931
and isinstance(other, np.ndarray)
931932
and other.dtype == bool
932933
):
933-
# TODO: Enforce in 3.0 (#60234)
934934
# GH#60234 backward compatibility for the move to StringDtype in 3.0
935935
op_name = op.__name__[1:].strip("_")
936936
warnings.warn(
937937
f"'{op_name}' operations between boolean dtype and {self.dtype} are "
938938
"deprecated and will raise in a future version. Explicitly "
939939
"cast the strings to a boolean dtype before operating instead.",
940-
FutureWarning,
940+
Pandas4Warning,
941941
stacklevel=find_stack_level(),
942942
)
943943
return op(other, self.astype(bool))

pandas/core/arrays/string_.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
pa_version_under12p1,
3030
)
3131
from pandas.compat.numpy import function as nv
32+
from pandas.errors import Pandas4Warning
3233
from pandas.util._decorators import (
3334
doc,
3435
set_module,
@@ -397,12 +398,11 @@ def _logical_method(self, other, op):
397398
):
398399
# GH#60234 backward compatibility for the move to StringDtype in 3.0
399400
op_name = op.__name__[1:].strip("_")
400-
# TODO: Enforce in 3.0 (#60234)
401401
warnings.warn(
402402
f"'{op_name}' operations between boolean dtype and {self.dtype} are "
403403
"deprecated and will raise in a future version. Explicitly "
404404
"cast the strings to a boolean dtype before operating instead.",
405-
FutureWarning,
405+
Pandas4Warning,
406406
stacklevel=find_stack_level(),
407407
)
408408
return op(other, self.astype(bool))

pandas/tests/strings/test_strings.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import numpy as np
77
import pytest
88

9+
from pandas.errors import Pandas4Warning
10+
911
from pandas import (
1012
NA,
1113
DataFrame,
@@ -803,7 +805,7 @@ def test_decode_with_dtype_none():
803805
def test_reversed_logical_ops(any_string_dtype):
804806
# GH#60234
805807
dtype = any_string_dtype
806-
warn = None if dtype == object else FutureWarning
808+
warn = None if dtype == object else Pandas4Warning
807809
left = Series([True, False, False, True])
808810
right = Series(["", "", "b", "c"], dtype=dtype)
809811

0 commit comments

Comments
 (0)