Skip to content

Commit 61e7d47

Browse files
kinowBruno P. Kinoshita
authored and
Bruno P. Kinoshita
committed
Use approach again that specifies the type length
1 parent d7da309 commit 61e7d47

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
@@ -749,12 +749,12 @@ def to_native_types(self, slicer=None, na_rep="nan", quoting=None, **kwargs):
749749
mask = isna(values)
750750

751751
if not self.is_object and not quoting:
752-
values[mask] = na_rep
753-
values = values.astype(str)
752+
itemsize = writers.max_len_string(na_rep)
753+
values = values.astype("<U{size}".format(size=itemsize))
754754
else:
755755
values = np.array(values, dtype="object")
756-
values[mask] = na_rep
757756

757+
values[mask] = na_rep
758758
return values
759759

760760
# block actions ####

0 commit comments

Comments
 (0)