Hidden Cells¶
You can remove cells from the HTML/LaTeX output by adding this to the cell metadata:
"nbsphinx": "hidden"
Hidden cells are still executed but removed afterwards.
For example, the following hidden cell defines the variable answer.
[ ]:
This is the cell after the hidden cell. Although the previous cell is not visible, its result is still available:
[2]:
answer
[2]:
42
Don’t overuse this, because it may make it harder to follow what’s going on in your notebook.
Also Markdown cells can be hidden. The following cell is hidden. Wowza!
[ ]:
This is the cell after the hidden cell.
[1]:
from docs_examples import *
[2]:
shelf = Shelf({
'state': Dimension(Census.state),
'age': WtdAvgMetric(Census.age, Census.pop2000),
'population': Metric(func.sum(Census.pop2000))
})
r = Recipe(shelf=shelf, session=oven.Session())\
.dimensions('state')\
.metrics('age')\
.order_by('-age')
[5]:
r.dataset.df
[5]:
| state | age | state_id | |
|---|---|---|---|
| 0 | Florida | 39.082839 | Florida |
| 1 | West Virginia | 38.555059 | West Virginia |
| 2 | Maine | 38.101184 | Maine |
| 3 | Pennsylvania | 38.038567 | Pennsylvania |
| 4 | Rhode Island | 37.203438 | Rhode Island |
| 5 | Connecticut | 37.198671 | Connecticut |
| 6 | Iowa | 37.078036 | Iowa |
| 7 | Vermont | 37.059797 | Vermont |
| 8 | Montana | 36.967495 | Montana |
| 9 | Massachusetts | 36.931742 | Massachusetts |
| 10 | Hawaii | 36.906323 | Hawaii |
| 11 | North Dakota | 36.886213 | North Dakota |
| 12 | New Jersey | 36.740688 | New Jersey |
| 13 | Arkansas | 36.637451 | Arkansas |
| 14 | Oregon | 36.496812 | Oregon |
| 15 | Missouri | 36.441899 | Missouri |
| 16 | New Hampshire | 36.431861 | New Hampshire |
| 17 | Ohio | 36.407557 | Ohio |
| 18 | District of Columbia | 36.402441 | District of Columbia |
| 19 | New York | 36.345351 | New York |
| 20 | Delaware | 36.330524 | Delaware |
| 21 | Alabama | 36.277879 | Alabama |
| 22 | Wisconsin | 36.251687 | Wisconsin |
| 23 | Tennessee | 36.246676 | Tennessee |
| 24 | Kentucky | 36.244734 | Kentucky |
| 25 | South Dakota | 36.222866 | South Dakota |
| 26 | Oklahoma | 36.110444 | Oklahoma |
| 27 | Nebraska | 36.002538 | Nebraska |
| 28 | North Carolina | 35.972045 | North Carolina |
| 29 | South Carolina | 35.940300 | South Carolina |
| 30 | Wyoming | 35.887779 | Wyoming |
| 31 | Virginia | 35.839892 | Virginia |
| 32 | Kansas | 35.803131 | Kansas |
| 33 | Maryland | 35.782296 | Maryland |
| 34 | Michigan | 35.733876 | Michigan |
| 35 | Indiana | 35.655149 | Indiana |
| 36 | Minnesota | 35.581938 | Minnesota |
| 37 | Washington | 35.507767 | Washington |
| 38 | Illinois | 35.376322 | Illinois |
| 39 | Arizona | 35.370655 | Arizona |
| 40 | Nevada | 35.282457 | Nevada |
| 41 | New Mexico | 34.973244 | New Mexico |
| 42 | Mississippi | 34.962652 | Mississippi |
| 43 | Louisiana | 34.829653 | Louisiana |
| 44 | Colorado | 34.538607 | Colorado |
| 45 | Idaho | 34.334502 | Idaho |
| 46 | California | 34.178726 | California |
| 47 | Georgia | 34.060715 | Georgia |
| 48 | Texas | 33.489209 | Texas |
| 49 | Alaska | 31.947385 | Alaska |
| 50 | Utah | 30.636222 | Utah |