Skip to content
Gunjan Baid edited this page May 9, 2017 · 10 revisions

Create a Blank Notebook

This section describes how to create a notebook on the JupyterHub infrastructure. Go to datahub.berkeley.edu. Click on the green "Start My Server" button.

server

Click on the "New" dropdown on the right side of the page. Select the option for "Python 3" under "Notebooks."

new You will see a blank notebook to which you can now add text and code. The notebook consists of sections called cells. There are different types of cells that can be used. Code is part of the "code" cell type and text is part of the "markdown" cell types.

Add a New Cell

You can add a new cell using eiher the "+" button on the left side or the "Insert" button on the toolbar.

new-cell

To set the type of this cell, click on "Cell" in the toolbar, then "Cell Type" and then either "Code" or "Markdown." Code can be directly typed in. Text must be added in markdown format. This is a good reference for markdown syntax.

cell-type

Here is an example of what code and markdown cells with content will look like.

cell-example

You will notice that there is no code output in the previous image. In addition, the text formatting is not properly displayed. To run code or see the formatted text, you must run the cell. An individual cell can be run by typing Shift-Enter from the cell. All cells can be run by clicking the play button in the toolbar (triangle with a line). You can also click on "Cell" in the toolbar for additional ways to run cells. Below is the output of running all cells.

output

Run Code

You can run code by either typing Shift-Enter from the cell or clicking the play button in the toolbar (triangle with a line).

#play-button

Code that has been run in one cell is accessible by another cell. If any changes are made to a cell, you must rerun all cells that you want affected by the change.

multiple-cells

Download Notebooks

Click on “File” in the toolbar, then “Download as”, then select ‘Notebook (.ipynb).” This will download the notebook to your computer in the standard Jupyter notebook format. You can also download notebooks in alternate formats, seen below.

download

Develop Locally

The above steps can also be done using a local installation of Jupyter Notebooks instead of the datahub.berkeley.edu infrastructure. If you choose to development assignments locally, we highly recommend that you upload and test the assignments on datahub.berkeley.edu as the local and cloud environments may be different.

Additional Resources

  • Markdown basics notebook - Double clicking on each cell allows you to see how a variety different content is formatted in Jupyter Notebooks.