{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "nbsphinx": "hidden"
   },
   "source": [
    "This notebook is part of the `nbsphinx` documentation: https://nbsphinx.readthedocs.io/."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Hidden Cells\n",
    "\n",
    "You can remove cells from the HTML/LaTeX output by adding this to the cell metadata:\n",
    "\n",
    "```\n",
    "\"nbsphinx\": \"hidden\"\n",
    "```\n",
    "\n",
    "Hidden cells are still executed but removed afterwards.\n",
    "\n",
    "For example, the following hidden cell defines the variable `answer`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "nbsphinx": "hidden"
   },
   "outputs": [],
   "source": [
    "answer = 6 * 7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This is the cell after the hidden cell.\n",
    "Although the previous cell is not visible, its result is still available:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "42"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "answer"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Don't overuse this, because it may make it harder to follow what's going on in your notebook.\n",
    "\n",
    "Also Markdown cells can be hidden.\n",
    "The following cell is hidden. Wowza!\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "nbsphinx": "hidden"
   },
   "source": [
    "I am a *hidden* Markdown cell!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "This is the cell after the hidden cell."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from docs_examples import *\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "shelf = Shelf({\n",
    "    'state': Dimension(Census.state),\n",
    "    'age': WtdAvgMetric(Census.age, Census.pop2000),\n",
    "    'population': Metric(func.sum(Census.pop2000))\n",
    "})\n",
    "\n",
    "r = Recipe(shelf=shelf, session=oven.Session())\\\n",
    "    .dimensions('state')\\\n",
    "    .metrics('age')\\\n",
    "    .order_by('-age')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>state</th>\n",
       "      <th>age</th>\n",
       "      <th>state_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Florida</td>\n",
       "      <td>39.082839</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>West Virginia</td>\n",
       "      <td>38.555059</td>\n",
       "      <td>West Virginia</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maine</td>\n",
       "      <td>38.101184</td>\n",
       "      <td>Maine</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Pennsylvania</td>\n",
       "      <td>38.038567</td>\n",
       "      <td>Pennsylvania</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Rhode Island</td>\n",
       "      <td>37.203438</td>\n",
       "      <td>Rhode Island</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Connecticut</td>\n",
       "      <td>37.198671</td>\n",
       "      <td>Connecticut</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Iowa</td>\n",
       "      <td>37.078036</td>\n",
       "      <td>Iowa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Vermont</td>\n",
       "      <td>37.059797</td>\n",
       "      <td>Vermont</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Montana</td>\n",
       "      <td>36.967495</td>\n",
       "      <td>Montana</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Massachusetts</td>\n",
       "      <td>36.931742</td>\n",
       "      <td>Massachusetts</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Hawaii</td>\n",
       "      <td>36.906323</td>\n",
       "      <td>Hawaii</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>North Dakota</td>\n",
       "      <td>36.886213</td>\n",
       "      <td>North Dakota</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>New Jersey</td>\n",
       "      <td>36.740688</td>\n",
       "      <td>New Jersey</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Arkansas</td>\n",
       "      <td>36.637451</td>\n",
       "      <td>Arkansas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Oregon</td>\n",
       "      <td>36.496812</td>\n",
       "      <td>Oregon</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Missouri</td>\n",
       "      <td>36.441899</td>\n",
       "      <td>Missouri</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>New Hampshire</td>\n",
       "      <td>36.431861</td>\n",
       "      <td>New Hampshire</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Ohio</td>\n",
       "      <td>36.407557</td>\n",
       "      <td>Ohio</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>District of Columbia</td>\n",
       "      <td>36.402441</td>\n",
       "      <td>District of Columbia</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>New York</td>\n",
       "      <td>36.345351</td>\n",
       "      <td>New York</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Delaware</td>\n",
       "      <td>36.330524</td>\n",
       "      <td>Delaware</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Alabama</td>\n",
       "      <td>36.277879</td>\n",
       "      <td>Alabama</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Wisconsin</td>\n",
       "      <td>36.251687</td>\n",
       "      <td>Wisconsin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Tennessee</td>\n",
       "      <td>36.246676</td>\n",
       "      <td>Tennessee</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>Kentucky</td>\n",
       "      <td>36.244734</td>\n",
       "      <td>Kentucky</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>South Dakota</td>\n",
       "      <td>36.222866</td>\n",
       "      <td>South Dakota</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Oklahoma</td>\n",
       "      <td>36.110444</td>\n",
       "      <td>Oklahoma</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>Nebraska</td>\n",
       "      <td>36.002538</td>\n",
       "      <td>Nebraska</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>North Carolina</td>\n",
       "      <td>35.972045</td>\n",
       "      <td>North Carolina</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>South Carolina</td>\n",
       "      <td>35.940300</td>\n",
       "      <td>South Carolina</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>Wyoming</td>\n",
       "      <td>35.887779</td>\n",
       "      <td>Wyoming</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>Virginia</td>\n",
       "      <td>35.839892</td>\n",
       "      <td>Virginia</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>Kansas</td>\n",
       "      <td>35.803131</td>\n",
       "      <td>Kansas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>Maryland</td>\n",
       "      <td>35.782296</td>\n",
       "      <td>Maryland</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>Michigan</td>\n",
       "      <td>35.733876</td>\n",
       "      <td>Michigan</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>Indiana</td>\n",
       "      <td>35.655149</td>\n",
       "      <td>Indiana</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>Minnesota</td>\n",
       "      <td>35.581938</td>\n",
       "      <td>Minnesota</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>Washington</td>\n",
       "      <td>35.507767</td>\n",
       "      <td>Washington</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>Illinois</td>\n",
       "      <td>35.376322</td>\n",
       "      <td>Illinois</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>Arizona</td>\n",
       "      <td>35.370655</td>\n",
       "      <td>Arizona</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>Nevada</td>\n",
       "      <td>35.282457</td>\n",
       "      <td>Nevada</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>New Mexico</td>\n",
       "      <td>34.973244</td>\n",
       "      <td>New Mexico</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>Mississippi</td>\n",
       "      <td>34.962652</td>\n",
       "      <td>Mississippi</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>Louisiana</td>\n",
       "      <td>34.829653</td>\n",
       "      <td>Louisiana</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>Colorado</td>\n",
       "      <td>34.538607</td>\n",
       "      <td>Colorado</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>Idaho</td>\n",
       "      <td>34.334502</td>\n",
       "      <td>Idaho</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>California</td>\n",
       "      <td>34.178726</td>\n",
       "      <td>California</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>Georgia</td>\n",
       "      <td>34.060715</td>\n",
       "      <td>Georgia</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>Texas</td>\n",
       "      <td>33.489209</td>\n",
       "      <td>Texas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>Alaska</td>\n",
       "      <td>31.947385</td>\n",
       "      <td>Alaska</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>Utah</td>\n",
       "      <td>30.636222</td>\n",
       "      <td>Utah</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   state        age              state_id\n",
       "0                Florida  39.082839               Florida\n",
       "1          West Virginia  38.555059         West Virginia\n",
       "2                  Maine  38.101184                 Maine\n",
       "3           Pennsylvania  38.038567          Pennsylvania\n",
       "4           Rhode Island  37.203438          Rhode Island\n",
       "5            Connecticut  37.198671           Connecticut\n",
       "6                   Iowa  37.078036                  Iowa\n",
       "7                Vermont  37.059797               Vermont\n",
       "8                Montana  36.967495               Montana\n",
       "9          Massachusetts  36.931742         Massachusetts\n",
       "10                Hawaii  36.906323                Hawaii\n",
       "11          North Dakota  36.886213          North Dakota\n",
       "12            New Jersey  36.740688            New Jersey\n",
       "13              Arkansas  36.637451              Arkansas\n",
       "14                Oregon  36.496812                Oregon\n",
       "15              Missouri  36.441899              Missouri\n",
       "16         New Hampshire  36.431861         New Hampshire\n",
       "17                  Ohio  36.407557                  Ohio\n",
       "18  District of Columbia  36.402441  District of Columbia\n",
       "19              New York  36.345351              New York\n",
       "20              Delaware  36.330524              Delaware\n",
       "21               Alabama  36.277879               Alabama\n",
       "22             Wisconsin  36.251687             Wisconsin\n",
       "23             Tennessee  36.246676             Tennessee\n",
       "24              Kentucky  36.244734              Kentucky\n",
       "25          South Dakota  36.222866          South Dakota\n",
       "26              Oklahoma  36.110444              Oklahoma\n",
       "27              Nebraska  36.002538              Nebraska\n",
       "28        North Carolina  35.972045        North Carolina\n",
       "29        South Carolina  35.940300        South Carolina\n",
       "30               Wyoming  35.887779               Wyoming\n",
       "31              Virginia  35.839892              Virginia\n",
       "32                Kansas  35.803131                Kansas\n",
       "33              Maryland  35.782296              Maryland\n",
       "34              Michigan  35.733876              Michigan\n",
       "35               Indiana  35.655149               Indiana\n",
       "36             Minnesota  35.581938             Minnesota\n",
       "37            Washington  35.507767            Washington\n",
       "38              Illinois  35.376322              Illinois\n",
       "39               Arizona  35.370655               Arizona\n",
       "40                Nevada  35.282457                Nevada\n",
       "41            New Mexico  34.973244            New Mexico\n",
       "42           Mississippi  34.962652           Mississippi\n",
       "43             Louisiana  34.829653             Louisiana\n",
       "44              Colorado  34.538607              Colorado\n",
       "45                 Idaho  34.334502                 Idaho\n",
       "46            California  34.178726            California\n",
       "47               Georgia  34.060715               Georgia\n",
       "48                 Texas  33.489209                 Texas\n",
       "49                Alaska  31.947385                Alaska\n",
       "50                  Utah  30.636222                  Utah"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.dataset.df"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Edit Metadata",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
