Skip to content

Commit 9aac9a8

Browse files
committed
improve pyarrow addition
1 parent 3b15abc commit 9aac9a8

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

pandas/core/dtypes/missing.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -207,18 +207,10 @@ def _isna(obj):
207207
elif isinstance(obj, ABCSeries):
208208
result = _isna_array(obj._values)
209209
# box
210-
if isinstance(obj.dtype, ArrowDtype):
211-
result = obj._constructor(
212-
result,
213-
index=obj.index,
214-
name=obj.name,
215-
copy=False,
216-
dtype="bool[pyarrow]",
217-
)
218-
else:
219-
result = obj._constructor(
220-
result, index=obj.index, name=obj.name, copy=False
221-
)
210+
new_dtype = "bool[pyarrow]" if isinstance(obj.dtype, ArrowDtype) else None
211+
result = obj._constructor(
212+
result, index=obj.index, name=obj.name, copy=False, dtype=new_dtype
213+
)
222214
return result
223215
elif isinstance(obj, ABCDataFrame):
224216
return obj.isna()

0 commit comments

Comments
 (0)