Skip to content

Commit dc13aba

Browse files
kinowBruno P. Kinoshita
authored and
Bruno P. Kinoshita
committed
Try changing order of statements for performance
1 parent c668252 commit dc13aba

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-
itemsize = writers.max_len_string(na_rep)
753-
values = values.astype("<U{size}".format(size=itemsize))
752+
values[mask] = na_rep
753+
values = values.astype(str)
754754
else:
755755
values = np.array(values, dtype="object")
756+
values[mask] = na_rep
756757

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

760760
# block actions ####

0 commit comments

Comments
 (0)