Skip to content

Commit

Permalink
Adjust TensorArray.isna() to avoid a corner case
Browse files Browse the repository at this point in the history
  • Loading branch information
frreiss committed Jul 7, 2021
1 parent 50a985e commit 777ac2f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion text_extensions_for_pandas/array/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,12 @@ def isna(self) -> np.array:
for information about this method.
"""
if self._tensor.dtype.type is np.object_:
return self._tensor == None
# Avoid comparing with __eq__ because the elements of the tensor may do
# something funny with that operation.
result_list = [
self._tensor[i] is None for i in range(len(self))
]
return np.array(result_list, dtype=bool)
elif self._tensor.dtype.type is np.str_:
return np.all(self._tensor == "", axis=-1)
else:
Expand Down

0 comments on commit 777ac2f

Please sign in to comment.