Skip to content

Commit 098c21a

Browse files
author
y-p
committed
DOC: Add comments, tweak option descriptions.
1 parent 40b9b38 commit 098c21a

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

pandas/core/config_init.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
: int
3535
This sets the maximum number of rows pandas should output when printing
3636
out various output. For example, this value determines whether the repr()
37-
for a dataframe prints out fully or just an summary repr.
37+
for a dataframe prints out fully or just a summary repr.
3838
"""
3939

4040
pc_max_cols_doc = """
@@ -127,18 +127,19 @@
127127

128128
pc_width_doc = """
129129
: int
130-
Width of the display. In case python/IPython is running in a terminal this
131-
can be set to 0 and pandas will correctly auto-detect the width. Note that
132-
the IPython notebook, IPython qtconsole, or IDLE do not run in a terminal
133-
and hence it is not possible to correctly detect the width.
130+
Width of the display in characters. In case python/IPython is running in
131+
a terminal this can be set to 0 and pandas will correctly auto-detect the
132+
width.
133+
Note that the IPython notebook, IPython qtconsole, or IDLE do not run in a
134+
terminal and hence it is not possible to correctly detect the width.
134135
"""
135136

136137
pc_height_doc = """
137138
: int
138-
Height of the display. In case python/IPython is running in a terminal this
139-
can be set to 0 and pandas will auto-detect the width. Note that the
140-
IPython notebook, IPython qtconsole, or IDLE do not run in a terminal,
141-
and hence it is not possible to correctly detect the height.
139+
Height of the display in lines. In case python/IPython is running in a
140+
terminal this can be set to 0 and pandas will auto-detect the width.
141+
Note that the IPython notebook, IPython qtconsole, or IDLE do not run
142+
in a terminal, and hence it is not possible to correctly detect the height.
142143
"""
143144

144145
pc_chop_threshold_doc = """

pandas/core/format.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,6 +1680,7 @@ def get_console_size():
16801680
display_height = get_option('display.height')
16811681

16821682
if com.in_interactive_session() and not com.in_ipnb_frontend():
1683+
# pure terminal
16831684
terminal_width, terminal_height = get_terminal_size()
16841685
else:
16851686
terminal_width, terminal_height = 80, 100

pandas/core/frame.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ def __nonzero__(self):
602602
def _repr_fits_vertical_(self):
603603
"""
604604
Check if full repr fits in vertical boundaries imposed by the display
605-
options height and max_columns. In case off non-interactive session,
605+
options height and max_rows. In case off non-interactive session,
606606
no boundaries apply.
607607
"""
608608
width, height = fmt.get_console_size()
@@ -664,16 +664,19 @@ def __unicode__(self):
664664
fits_vertical = self._repr_fits_vertical_()
665665
fits_horizontal = False
666666
if fits_vertical:
667+
# This needs to compute the entire repr
668+
# so don't do it unless rownum is bounded
667669
fits_horizontal = self._repr_fits_horizontal_()
668670

669671
if fits_vertical and fits_horizontal:
670672
self.to_string(buf=buf)
671673
else:
672674
width, height = fmt.get_console_size()
673675
max_rows = get_option("display.max_rows") or height
674-
# Expand or info? Decide based on option display.expand_frame_repr
675-
# and keep it sane for the number of display rows used by the
676-
# expanded repr.
676+
# expand_repr basically takes the extrac columns that don't
677+
# fit the width, and creates a new page, which increases
678+
# the effective row count. check number of cols agaibst
679+
# max rows to catch wrapping. that would exceed max_rows.
677680
if (get_option("display.expand_frame_repr") and fits_vertical and
678681
len(self.columns) < max_rows):
679682
self.to_string(buf=buf, line_width=width)

0 commit comments

Comments
 (0)