A quick look at the Colab/Jupyter interface#

NOTE This page will provide a useful reference in the future for when you think “how do I turn this on and off again”

A “cell” is a box in the Jupyter notebook. You can see one below.

When you are editing a cell in Jupyter notebook, you need to run (or re-run) the cell by pressing <Shift> + <Enter>. This will allow changes you made to be available to other cells.

Use <Enter> to make new lines inside a cell you are editing.

Code cells#

Re-running will execute any statements you have written. To edit an existing code cell, click on it.

Text cells (also known as Markdown cells)#

Re-running will render the text cell. To edit an existing markdown cell, double-click on it.

Common Colab/Jupyter operations#

Near the top of the page, Colab provides a row of menu options (File, Edit, View, Insert, …). Also, after highlighting a cell there is a row of icons appearing on the RHS:

image.png

Inserting and removing cells#

Use the

image.png

buttons to insert either a code or text cell below the currently selected cell.

Clear the output of all cells#

  • Use “EDIT” -> “Clear All OUTPUTS”

Clearing the memory / restarting the kernel#

  • Use “Runtime” -> “Restart Runtime”.

Save your notebook file locally#

  • Clear the output of all cells

  • Use “File” -> “Download .ipynb” to download a notebook file representing your session

Accessing Colab from Jupyter book#

THERE IS A VIDEO ON MOODLE SHOWING HOW TO DO THIS

  • Within Jupyter Book, click on the rocket at the top.

  • Select “Colab” (other options will not do anything useful)

  • After notebook opens in Colab click “Copy to Drive”

  • Rename notebook as you want.

  • WOrk through notebook interactively!

You can then access the notebook using the Google Drive link in Moodle.

Colab’s own documentation#

Colab provides it’s own documentation page here:

This is a good if you know python and want to understand Colab, but no so good if you’re just learning python.