Commit 34b5975
authored
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> 🦕1 parent dbe8e7e commit 34b5975
File tree
7 files changed
+332
-12
lines changed- bigframes/display
- notebooks/dataframes
- tests
- js
- unit/display
7 files changed
+332
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| 107 | + | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| 112 | + | |
| 113 | + | |
110 | 114 | | |
111 | 115 | | |
112 | 116 | | |
| |||
218 | 222 | | |
219 | 223 | | |
220 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
221 | 233 | | |
222 | 234 | | |
223 | 235 | | |
| |||
348 | 360 | | |
349 | 361 | | |
350 | 362 | | |
| 363 | + | |
351 | 364 | | |
352 | 365 | | |
353 | 366 | | |
| |||
382 | 395 | | |
383 | 396 | | |
384 | 397 | | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | | - | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
56 | 79 | | |
57 | 80 | | |
58 | 81 | | |
59 | 82 | | |
60 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
61 | 90 | | |
62 | 91 | | |
63 | | - | |
| 92 | + | |
| 93 | + | |
64 | 94 | | |
65 | 95 | | |
66 | 96 | | |
| |||
69 | 99 | | |
70 | 100 | | |
71 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
72 | 114 | | |
73 | 115 | | |
74 | 116 | | |
75 | 117 | | |
76 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
77 | 124 | | |
78 | 125 | | |
79 | 126 | | |
80 | 127 | | |
81 | 128 | | |
82 | 129 | | |
83 | 130 | | |
84 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
85 | 134 | | |
86 | 135 | | |
87 | 136 | | |
| |||
101 | 150 | | |
102 | 151 | | |
103 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
104 | 164 | | |
105 | 165 | | |
106 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
129 | 138 | | |
130 | 139 | | |
131 | 140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
| |||
102 | 107 | | |
103 | 108 | | |
104 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
105 | 136 | | |
106 | 137 | | |
107 | 138 | | |
| |||
259 | 290 | | |
260 | 291 | | |
261 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
262 | 299 | | |
263 | 300 | | |
264 | 301 | | |
| |||
270 | 307 | | |
271 | 308 | | |
272 | 309 | | |
| 310 | + | |
273 | 311 | | |
274 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
275 | 320 | | |
276 | 321 | | |
277 | | - | |
| 322 | + | |
278 | 323 | | |
279 | 324 | | |
280 | 325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
511 | 512 | | |
512 | 513 | | |
513 | 514 | | |
514 | | - | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
515 | 519 | | |
516 | 520 | | |
517 | 521 | | |
| |||
0 commit comments