Skip to content

Commit 0b6a97f

Browse files
committed
Try changing order of statements for performance
1 parent 7b1c1d8 commit 0b6a97f

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

725725
if not self.is_object and not quoting:
726-
itemsize = writers.max_len_string(na_rep)
727-
values = values.astype("<U{size}".format(size=itemsize))
726+
values[mask] = na_rep
727+
values = values.astype(str)
728728
else:
729729
values = np.array(values, dtype='object')
730+
values[mask] = na_rep
730731

731-
values[mask] = na_rep
732732
return values
733733

734734
# block actions ####

0 commit comments

Comments
 (0)