File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -465,7 +465,8 @@ cpdef ndarray[object] astype_unicode(ndarray arr):
465
465
for i in range (n):
466
466
# we can use the unsafe version because we know `result` is mutable
467
467
# since it was created from `np.empty`
468
- util.set_value_at_unsafe(result, i, unicode (arr[i]))
468
+ arr_i = arr[i]
469
+ util.set_value_at_unsafe(result, i, unicode (arr_i) if arr_i is not np.nan else ' ' )
469
470
470
471
return result
471
472
@@ -478,7 +479,8 @@ cpdef ndarray[object] astype_str(ndarray arr):
478
479
for i in range (n):
479
480
# we can use the unsafe version because we know `result` is mutable
480
481
# since it was created from `np.empty`
481
- util.set_value_at_unsafe(result, i, str (arr[i]))
482
+ arr_i = arr[i]
483
+ util.set_value_at_unsafe(result, i, str (arr_i) if arr_i is not np.nan else ' ' )
482
484
483
485
return result
484
486
You can’t perform that action at this time.
0 commit comments