Skip to content

Commit

Permalink
feat: default repr to showing all columns in Jupyter notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist authored and cpcloud committed Mar 24, 2023
1 parent 0bdd093 commit 91a0811
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ibis/backends/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,8 @@ def test_interactive_repr_max_columns(alltypes, is_jupyter, monkeypatch):
text = "".join(s.text for s in console.render(expr, options))
assert " c_0 " in text
if is_jupyter:
# Default of 20 columns are written
assert " c_19 " in text
# All columns are written
assert " c_49 " in text
else:
# width calculations truncates well before 20 columns
assert " c_19 " not in text
Expand Down
8 changes: 3 additions & 5 deletions ibis/expr/types/pretty.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,9 @@ def to_rich_table(table, console_width=None):

max_columns = ibis.options.repr.interactive.max_columns
if console_width == float("inf"):
if max_columns == 0:
# Show up to 20 columns by default, mirroring pandas's behavior
if orig_ncols >= 20:
table = table.select(*table.columns[:20])
elif max_columns is not None and max_columns < orig_ncols:
# When there's infinite display space, only subset columns
# if an explicit limit has been set.
if max_columns and max_columns < orig_ncols:
table = table.select(*table.columns[:max_columns])
else:
# Determine the maximum subset of columns that *might* fit in the
Expand Down

0 comments on commit 91a0811

Please sign in to comment.