Skip to content

Commit 777ac2f

Browse files
committed
Adjust TensorArray.isna() to avoid a corner case
1 parent 50a985e commit 777ac2f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

text_extensions_for_pandas/array/tensor.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,12 @@ def isna(self) -> np.array:
349349
for information about this method.
350350
"""
351351
if self._tensor.dtype.type is np.object_:
352-
return self._tensor == None
352+
# Avoid comparing with __eq__ because the elements of the tensor may do
353+
# something funny with that operation.
354+
result_list = [
355+
self._tensor[i] is None for i in range(len(self))
356+
]
357+
return np.array(result_list, dtype=bool)
353358
elif self._tensor.dtype.type is np.str_:
354359
return np.all(self._tensor == "", axis=-1)
355360
else:

0 commit comments

Comments
 (0)