File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -215,7 +215,9 @@ def isin(self, values) -> npt.NDArray[np.bool_]:
215
215
if not len (value_set ):
216
216
return np .zeros (len (self ), dtype = bool )
217
217
218
- result = pc .is_in (self ._pa_array , value_set = pa .array (value_set ))
218
+ result = pc .is_in (
219
+ self ._pa_array , value_set = pa .array (value_set , type = self ._pa_array .type )
220
+ )
219
221
# pyarrow 2.0.0 returned nulls, so we explicily specify dtype to convert nulls
220
222
# to False
221
223
return np .array (result , dtype = np .bool_ )
Original file line number Diff line number Diff line change 10
10
11
11
from pandas .compat import IS64
12
12
from pandas .errors import InvalidIndexError
13
+ import pandas .util ._test_decorators as td
13
14
14
15
from pandas .core .dtypes .common import (
15
16
is_any_real_numeric_dtype ,
@@ -915,6 +916,14 @@ def test_isin_empty(self, empty):
915
916
result = index .isin (empty )
916
917
tm .assert_numpy_array_equal (expected , result )
917
918
919
+ @td .skip_if_no ("pyarrow" )
920
+ def test_isin_arrow_string_null (self ):
921
+ # GH#55821
922
+ index = Index (["a" , "b" ], dtype = "string[pyarrow_numpy]" )
923
+ result = index .isin ([None ])
924
+ expected = np .array ([False , False ])
925
+ tm .assert_numpy_array_equal (result , expected )
926
+
918
927
@pytest .mark .parametrize (
919
928
"values" ,
920
929
[
You can’t perform that action at this time.
0 commit comments