Skip to content

Commit 8fc504b

Browse files
kinowBruno P. Kinoshita
authored and
Bruno P. Kinoshita
committed
Use approach again that specifies the type length
1 parent 26749bd commit 8fc504b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/core/internals/blocks.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -709,12 +709,12 @@ def to_native_types(self, slicer=None, na_rep="nan", quoting=None, **kwargs):
709709
mask = isna(values)
710710

711711
if not self.is_object and not quoting:
712-
values[mask] = na_rep
713-
values = values.astype(str)
712+
itemsize = writers.max_len_string(na_rep)
713+
values = values.astype("<U{size}".format(size=itemsize))
714714
else:
715715
values = np.array(values, dtype="object")
716-
values[mask] = na_rep
717716

717+
values[mask] = na_rep
718718
return values
719719

720720
# block actions #

0 commit comments

Comments
 (0)