Skip to content

Commit 01c1f5b

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

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/core/internals/blocks.py

+4-4
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:
755-
values = np.array(values, dtype="object")
756-
values[mask] = na_rep
755+
values = np.array(values, dtype='object')
757756

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

760760
# block actions ####

0 commit comments

Comments
 (0)