Skip to content

Commit 621485b

Browse files
committed
differnet object types in object block
1 parent 38d03f9 commit 621485b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pandas/core/missing.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ def mask_missing(arr, values_to_mask):
5454
if is_numeric_v_string_like(arr, x):
5555
mask = False
5656
elif arr.dtype.kind == 'O':
57-
mask = np.array([i == x.tolist() for i in arr.ravel()])
57+
try:
58+
m = [i == x.tolist() for i in arr.ravel()]
59+
except AttributeError:
60+
m = [i == x for i in arr.ravel()]
61+
finally:
62+
mask = np.array(m, dtype=bool)
5863
else:
5964
mask = arr == x
6065

@@ -68,7 +73,12 @@ def mask_missing(arr, values_to_mask):
6873
if is_numeric_v_string_like(arr, x):
6974
mask |= False
7075
elif arr.dtype.kind == 'O':
71-
mask |= np.array([i == x.tolist() for i in arr.ravel()])
76+
try:
77+
m = [i == x.tolist() for i in arr.ravel()]
78+
except AttributeError:
79+
m = [i == x for i in arr.ravel()]
80+
finally:
81+
mask |= np.array(m, dtype=bool)
7282
else:
7383
mask |= arr == x
7484

0 commit comments

Comments
 (0)