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_]:
215215 if not len (value_set ):
216216 return np .zeros (len (self ), dtype = bool )
217217
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+ )
219221 # pyarrow 2.0.0 returned nulls, so we explicily specify dtype to convert nulls
220222 # to False
221223 return np .array (result , dtype = np .bool_ )
Original file line number Diff line number Diff line change 1010
1111from pandas .compat import IS64
1212from pandas .errors import InvalidIndexError
13+ import pandas .util ._test_decorators as td
1314
1415from pandas .core .dtypes .common import (
1516 is_any_real_numeric_dtype ,
@@ -915,6 +916,14 @@ def test_isin_empty(self, empty):
915916 result = index .isin (empty )
916917 tm .assert_numpy_array_equal (expected , result )
917918
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+
918927 @pytest .mark .parametrize (
919928 "values" ,
920929 [
You can’t perform that action at this time.
0 commit comments