File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -461,6 +461,7 @@ cpdef ndarray[object] astype_unicode(ndarray arr):
461
461
cdef:
462
462
Py_ssize_t i, n = arr.size
463
463
ndarray[object ] result = np.empty(n, dtype = object )
464
+ object arr_i
464
465
465
466
for i in range (n):
466
467
# we can use the unsafe version because we know `result` is mutable
@@ -469,7 +470,8 @@ cpdef ndarray[object] astype_unicode(ndarray arr):
469
470
util.set_value_at_unsafe(
470
471
result,
471
472
i,
472
- unicode (arr_i) if arr_i is not np.nan else np.nan)
473
+ unicode (arr_i) if not checknull(arr_i) else np.nan
474
+ )
473
475
474
476
return result
475
477
@@ -478,6 +480,7 @@ cpdef ndarray[object] astype_str(ndarray arr):
478
480
cdef:
479
481
Py_ssize_t i, n = arr.size
480
482
ndarray[object ] result = np.empty(n, dtype = object )
483
+ object arr_i
481
484
482
485
for i in range (n):
483
486
# we can use the unsafe version because we know `result` is mutable
@@ -486,7 +489,8 @@ cpdef ndarray[object] astype_str(ndarray arr):
486
489
util.set_value_at_unsafe(
487
490
result,
488
491
i,
489
- str (arr_i) if arr_i is not np.nan else np.nan)
492
+ str (arr_i) if not checknull(arr_i) else np.nan
493
+ )
490
494
491
495
return result
492
496
You can’t perform that action at this time.
0 commit comments