@@ -171,6 +171,12 @@ class TestMaskedArrays(base.ExtensionTests):
171
171
@pytest .mark .parametrize ("na_action" , [None , "ignore" ])
172
172
def test_map (self , data_missing , na_action ):
173
173
result = data_missing .map (lambda x : x , na_action = na_action )
174
+ if data_missing .dtype .kind != "b" :
175
+ for i in range (len (result )):
176
+ if result [i ] is pd .NA :
177
+ result [i ] = "nan"
178
+ result = result .astype ("float64" )
179
+
174
180
if data_missing .dtype == Float32Dtype ():
175
181
# map roundtrips through objects, which converts to float64
176
182
expected = data_missing .to_numpy (dtype = "float64" , na_value = np .nan )
@@ -181,10 +187,15 @@ def test_map(self, data_missing, na_action):
181
187
def test_map_na_action_ignore (self , data_missing_for_sorting ):
182
188
zero = data_missing_for_sorting [2 ]
183
189
result = data_missing_for_sorting .map (lambda x : zero , na_action = "ignore" )
190
+
184
191
if data_missing_for_sorting .dtype .kind == "b" :
185
192
expected = np .array ([False , pd .NA , False ], dtype = object )
186
193
else :
187
194
expected = np .array ([zero , np .nan , zero ])
195
+ for i in range (len (result )):
196
+ if result [i ] is pd .NA :
197
+ result [i ] = "nan"
198
+ result = result .astype ("float64" )
188
199
tm .assert_numpy_array_equal (result , expected )
189
200
190
201
def _get_expected_exception (self , op_name , obj , other ):
0 commit comments