You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add max_columns control for anywidget mode (#2374)
This PR introduces a max_columns configuration for anywidget mode,
giving users control over how many columns are rendered in the
interactive table. This is particularly useful for improving readability
and performance when working with wide DataFrames.
Key Changes:
* Configurable Column Limit: Users can now set
bigframes.options.display.max_columns to limit the number of displayed
columns.
* Interactive Control: The TableWidget now includes a "Max columns"
dropdown in the footer, allowing users to dynamically adjust this
setting (options: 3, 5, 10, 15, 20, All).
* Smart Truncation: When columns exceed the limit, the table displays
the first N/2 and last N/2 columns, separated by an ellipsis (...)
column.
* Default Value: The default max_columns is set to 7 to provide a
balanced view on standard screens without requiring horizontal
scrolling.
Example Usage:
```
1 import bigframes.pandas as bpd
2
3 # Set global option
4 bpd.options.display.max_columns = 10
5
6 # Or use context manager
7 with bpd.option_context("display.max_columns", 5):
8 display(df)
```
verified at:
* vs code notebook:
http://screencast/cast/NTE2MDM4NTkxNjE3NDMzNnw2ZGI5YjAxOS1jMw
* colab notebook: screen/A8CBDFHyoJTzkAu
Fixes #<452681068> 🦕
Copy file name to clipboardExpand all lines: notebooks/dataframes/anywidget_mode.ipynb
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,8 @@
51
51
"- **Rich DataFrames & Series:** Both DataFrames and Series are displayed as interactive widgets.\n",
52
52
"- **Pagination:** Navigate through large datasets page by page without overwhelming the output.\n",
53
53
"- **Column Sorting:** Click column headers to toggle between ascending, descending, and unsorted views. Use **Shift + Click** to sort by multiple columns.\n",
54
-
"- **Column Resizing:** Drag the dividers between column headers to adjust their width."
54
+
"- **Column Resizing:** Drag the dividers between column headers to adjust their width.\n",
55
+
"- **Max Columns Control:** Limit the number of displayed columns to improve performance and readability for wide datasets."
55
56
]
56
57
},
57
58
{
@@ -511,7 +512,10 @@
511
512
"metadata": {},
512
513
"source": [
513
514
"### Adjustable Column Widths\n",
514
-
"You can easily adjust the width of any column in the table. Simply hover your mouse over the vertical dividers between column headers. When the cursor changes to a resize icon, click and drag to expand or shrink the column to your desired width. This allows for better readability and customization of your table view."
515
+
"You can easily adjust the width of any column in the table. Simply hover your mouse over the vertical dividers between column headers. When the cursor changes to a resize icon, click and drag to expand or shrink the column to your desired width. This allows for better readability and customization of your table view.\n",
516
+
"\n",
517
+
"### Control Maximum Columns\n",
518
+
"You can control the number of columns displayed in the widget using the **Max columns** dropdown in the footer. This is useful for wide DataFrames where you want to focus on a subset of columns or improve rendering performance. Options include 3, 5, 7, 10, 20, or All."
0 commit comments