Skip to content

Commit 0f93786

Browse files
kinowBruno P. Kinoshita
authored and
Bruno P. Kinoshita
committed
Try changing order of statements for performance
1 parent 32577d2 commit 0f93786

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
@@ -726,12 +726,12 @@ def to_native_types(self, slicer=None, na_rep='nan', quoting=None,
726726
mask = isna(values)
727727

728728
if not self.is_object and not quoting:
729-
itemsize = writers.max_len_string(na_rep)
730-
values = values.astype("<U{size}".format(size=itemsize))
729+
values[mask] = na_rep
730+
values = values.astype(str)
731731
else:
732732
values = np.array(values, dtype='object')
733+
values[mask] = na_rep
733734

734-
values[mask] = na_rep
735735
return values
736736

737737
# block actions ####

0 commit comments

Comments
 (0)