Column Subset
Select and reorder columns with the columns parameter:
from great_docs import tbl_preview
from gdtest_tbl_preview import sample_inventory
data = sample_inventory(25)
tbl_preview(data, columns=["product", "price", "rating"])
TableRows25Columns5 |
|
|
|
|
| 0 |
Contraption |
133.76 |
1.5 |
| 1 |
Contraption |
12.23 |
4.3 |
| 2 |
Thingamajig |
9.54 |
1.7 |
| 3 |
Doohickey |
97.38 |
1.3 |
| 4 |
Thingamajig |
164.84 |
2.2 |
| 20 |
Doohickey |
140.52 |
3.6 |
| 21 |
Whatchamacallit |
184.83 |
3.6 |
| 22 |
Gadget |
30.53 |
2.2 |
| 23 |
Gadget |
173.47 |
4.5 |
| 24 |
Apparatus |
121.94 |
3.9 |
Wide Table
A table with 20 columns overflows and scrolls horizontally:
from gdtest_tbl_preview import sample_wide
tbl_preview(sample_wide(12, 20))
TableRows12Columns20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 0 |
-0.256 |
-1.666 |
0.309 |
-0.447 |
-0.106 |
0.615 |
-1.9 |
0.519 |
-1.311 |
-0.88 |
-0.787 |
0.764 |
-1.124 |
-0.226 |
-0.341 |
0.797 |
0.222 |
0.001 |
0.4 |
1.424 |
| 1 |
0.511 |
0.855 |
0.394 |
-0.957 |
-0.817 |
-0.612 |
-2.518 |
0.548 |
1.61 |
0.946 |
0.632 |
0.566 |
0.244 |
-0.063 |
0.623 |
0.141 |
0.639 |
-1.14 |
0.41 |
-0.263 |
| 2 |
-0.226 |
0.506 |
-0.661 |
-0.521 |
0.497 |
-0.453 |
0.357 |
-1.568 |
0.552 |
1.465 |
1.129 |
2.011 |
0.398 |
-2.728 |
1.092 |
-0.088 |
-1.527 |
0.766 |
1.498 |
-2.297 |
| 3 |
-0.315 |
0.499 |
1.718 |
1.221 |
-0.062 |
-1.265 |
-0.736 |
1.282 |
-0.15 |
-0.445 |
0.859 |
0.325 |
0.239 |
-0.487 |
-2.683 |
1.533 |
-1.51 |
1.589 |
-1.02 |
-0.387 |
| 4 |
-0.93 |
-1.691 |
0.557 |
-0.808 |
-1.465 |
-0.968 |
-1.12 |
0.955 |
0.325 |
-1.38 |
0.345 |
-0.428 |
-0.431 |
1.009 |
1.089 |
1.048 |
0.615 |
-0.89 |
1.136 |
-1.854 |
| 7 |
0.424 |
-0.468 |
-0.74 |
-1.49 |
0.946 |
-2.032 |
0.157 |
-0.634 |
1.146 |
-0.298 |
0.575 |
0.924 |
-0.522 |
0.954 |
-1.492 |
-1.147 |
-1.47 |
-0.178 |
-0.181 |
-0.611 |
| 8 |
1.037 |
0.305 |
-0.344 |
0.048 |
1.441 |
-1.458 |
0.246 |
0.842 |
-0.662 |
1.405 |
-0.176 |
-0.337 |
2.43 |
0.856 |
0.176 |
0.915 |
1.266 |
-1.972 |
-0.744 |
-0.01 |
| 9 |
0.249 |
-0.046 |
-0.106 |
1.306 |
0.362 |
0.239 |
0.434 |
-1.811 |
-0.415 |
-1.027 |
0.277 |
0.386 |
0.355 |
1.491 |
1.195 |
-0.266 |
0.747 |
1.407 |
1.019 |
0.833 |
| 10 |
0.395 |
0.521 |
0.632 |
-2.014 |
0.119 |
1.443 |
1.594 |
-0.184 |
1.042 |
1.261 |
0.573 |
1.837 |
-0.554 |
-1.701 |
-0.149 |
0.132 |
1.473 |
-0.096 |
0.115 |
0.079 |
| 11 |
0.185 |
-0.642 |
0.248 |
-0.322 |
-1.299 |
0.578 |
0.619 |
1.02 |
0.027 |
-1.268 |
0.001 |
-2.565 |
-0.099 |
-0.353 |
0.191 |
0.705 |
-0.938 |
-0.603 |
0.124 |
1.327 |
No Row Numbers
tbl_preview(
sample_inventory(10),
show_row_numbers=False,
)
TableRows10Columns5 |
|
|
|
|
|
| Contraption |
Office |
159.56 |
346 |
2.7 |
| Contraption |
Office |
158.72 |
396 |
2.5 |
| Thingamajig |
Electronics |
165.35 |
44 |
4.7 |
| Doohickey |
Office |
172.99 |
240 |
1.3 |
| Thingamajig |
Garden |
46.46 |
161 |
3.1 |
| Thingamajig |
Tools |
94.99 |
206 |
1.8 |
| Doohickey |
Garden |
39.91 |
21 |
2.9 |
| Gadget |
Office |
115.55 |
137 |
1.2 |
| Gizmo |
Office |
21.18 |
285 |
1.5 |
| Contraption |
Tools |
144.75 |
3 |
4.8 |
No Dtype Labels
tbl_preview(
sample_inventory(10),
show_dtypes=False,
)
TableRows10Columns5 |
|
product |
category |
price |
stock |
rating |
| 0 |
Contraption |
Office |
159.56 |
346 |
2.7 |
| 1 |
Contraption |
Office |
158.72 |
396 |
2.5 |
| 2 |
Thingamajig |
Electronics |
165.35 |
44 |
4.7 |
| 3 |
Doohickey |
Office |
172.99 |
240 |
1.3 |
| 4 |
Thingamajig |
Garden |
46.46 |
161 |
3.1 |
| 5 |
Thingamajig |
Tools |
94.99 |
206 |
1.8 |
| 6 |
Doohickey |
Garden |
39.91 |
21 |
2.9 |
| 7 |
Gadget |
Office |
115.55 |
137 |
1.2 |
| 8 |
Gizmo |
Office |
21.18 |
285 |
1.5 |
| 9 |
Contraption |
Tools |
144.75 |
3 |
4.8 |