Skip to content

Commit 781354f

Browse files
committed
Use approach again that specifies the type length
1 parent 50c303b commit 781354f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/core/internals/blocks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,12 +712,12 @@ def to_native_types(self, slicer=None, na_rep='nan', quoting=None,
712712
mask = isna(values)
713713

714714
if not self.is_object and not quoting:
715-
values[mask] = na_rep
716-
values = values.astype(str)
715+
itemsize = writers.max_len_string(na_rep)
716+
values = values.astype("<U{size}".format(size=itemsize))
717717
else:
718718
values = np.array(values, dtype='object')
719-
values[mask] = na_rep
720719

720+
values[mask] = na_rep
721721
return values
722722

723723
# block actions ####

0 commit comments

Comments
 (0)