Skip to content

Commit 04d8752

Browse files
committed
Try changing order of statements for performance
1 parent 8adc42c commit 04d8752

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

741741
if not self.is_object and not quoting:
742-
itemsize = writers.max_len_string(na_rep)
743-
values = values.astype("<U{size}".format(size=itemsize))
742+
values[mask] = na_rep
743+
values = values.astype(str)
744744
else:
745745
values = np.array(values, dtype='object')
746+
values[mask] = na_rep
746747

747-
values[mask] = na_rep
748748
return values
749749

750750
# block actions ####

0 commit comments

Comments
 (0)