Skip to content

Commit 745408f

Browse files
committed
BUG: fix max_columns=0, close #2856
1 parent d749b91 commit 745408f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pandas/core/frame.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,8 @@ def _need_info_repr_(self):
604604
Check if it is needed to use info/summary view to represent a
605605
particular DataFrame.
606606
"""
607+
if not get_option("display.expand_frame_repr"):
608+
return True
607609

608610
if com.in_qtconsole():
609611
terminal_width, terminal_height = 100, 100
@@ -612,28 +614,25 @@ def _need_info_repr_(self):
612614
max_rows = (terminal_height if get_option("display.max_rows") == 0
613615
else get_option("display.max_rows"))
614616
max_columns = get_option("display.max_columns")
615-
expand_repr = get_option("display.expand_frame_repr")
616617

617618
if max_columns > 0:
618619
if (len(self.index) <= max_rows and
619-
(len(self.columns) <= max_columns and expand_repr)):
620+
(len(self.columns) <= max_columns)):
620621
return False
621622
else:
622623
return True
623624
else:
624625
# save us
625626
if (len(self.index) > max_rows or
626627
(com.in_interactive_session() and
627-
len(self.columns) > terminal_width // 2 and
628-
not expand_repr)):
628+
len(self.columns) > terminal_width // 2)):
629629
return True
630630
else:
631631
buf = StringIO()
632632
self.to_string(buf=buf)
633633
value = buf.getvalue()
634634
if (max([len(l) for l in value.split('\n')]) > terminal_width
635-
and com.in_interactive_session()
636-
and not expand_repr):
635+
and com.in_interactive_session()):
637636
return True
638637
else:
639638
return False

0 commit comments

Comments
 (0)