File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -37,16 +37,24 @@ def mask_missing(arr, values_to_mask):
37
37
except Exception :
38
38
values_to_mask = np .array (values_to_mask , dtype = object )
39
39
40
+ if values_to_mask .ndim == 1 and values_to_mask .size == 0 :
41
+ values_to_mask = values_to_mask [np .newaxis , :]
42
+
40
43
na_mask = isna (values_to_mask )
41
44
nonna = values_to_mask [~ na_mask ]
42
45
46
+ if values_to_mask .ndim == 2 and nonna .ndim == 1 :
47
+ nonna = nonna [np .newaxis , :]
48
+
43
49
mask = None
44
50
for x in nonna :
45
51
if mask is None :
46
52
47
53
# numpy elementwise comparison warning
48
54
if is_numeric_v_string_like (arr , x ):
49
55
mask = False
56
+ elif arr .dtype .kind == 'O' :
57
+ mask = np .array ([i == x .tolist () for i in arr .ravel ()])
50
58
else :
51
59
mask = arr == x
52
60
@@ -59,6 +67,8 @@ def mask_missing(arr, values_to_mask):
59
67
# numpy elementwise comparison warning
60
68
if is_numeric_v_string_like (arr , x ):
61
69
mask |= False
70
+ elif arr .dtype .kind == 'O' :
71
+ mask |= np .array ([i == x .tolist () for i in arr .ravel ()])
62
72
else :
63
73
mask |= arr == x
64
74
You can’t perform that action at this time.
0 commit comments