Skip to content

Commit ce8c0da

Browse files
Performance boost to printing DataFrames
1 parent 6cc5f23 commit ce8c0da

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/io/formats/format.py

+6
Original file line numberDiff line numberDiff line change
@@ -948,12 +948,18 @@ def _format(x):
948948
is_float_type = lib.map_infer(vals, is_float) & notna(vals)
949949
leading_space = is_float_type.any()
950950

951+
adj = _get_adjustment()
952+
conf_max = get_option("display.max_colwidth")
953+
951954
fmt_values = []
952955
for i, v in enumerate(vals):
953956
if not is_float_type[i] and leading_space:
954957
fmt_values.append(u' {v}'.format(v=_format(v)))
955958
elif is_float_type[i]:
956959
fmt_values.append(float_format(v))
960+
elif conf_max is not None and (type(v) is compat.binary_type
961+
or type(v) is compat.text_type):
962+
fmt_values.append(u' {v}'.format(v=_format(v[:conf_max*5])))
957963
else:
958964
fmt_values.append(u' {v}'.format(v=_format(v)))
959965

0 commit comments

Comments
 (0)