Skip to content

Commit

Permalink
BUG: fix max_columns=0, close #2856
Browse files Browse the repository at this point in the history
  • Loading branch information
lodagro committed Apr 10, 2013
1 parent d749b91 commit 745408f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,8 @@ def _need_info_repr_(self):
Check if it is needed to use info/summary view to represent a
particular DataFrame.
"""
if not get_option("display.expand_frame_repr"):
return True

if com.in_qtconsole():
terminal_width, terminal_height = 100, 100
Expand All @@ -612,28 +614,25 @@ def _need_info_repr_(self):
max_rows = (terminal_height if get_option("display.max_rows") == 0
else get_option("display.max_rows"))
max_columns = get_option("display.max_columns")
expand_repr = get_option("display.expand_frame_repr")

if max_columns > 0:
if (len(self.index) <= max_rows and
(len(self.columns) <= max_columns and expand_repr)):
(len(self.columns) <= max_columns)):
return False
else:
return True
else:
# save us
if (len(self.index) > max_rows or
(com.in_interactive_session() and
len(self.columns) > terminal_width // 2 and
not expand_repr)):
len(self.columns) > terminal_width // 2)):
return True
else:
buf = StringIO()
self.to_string(buf=buf)
value = buf.getvalue()
if (max([len(l) for l in value.split('\n')]) > terminal_width
and com.in_interactive_session()
and not expand_repr):
and com.in_interactive_session()):
return True
else:
return False
Expand Down

0 comments on commit 745408f

Please sign in to comment.