Not logged in. Login

Working with Jupyter Notebooks

Jupyter Notebooks are a beautiful way to interact with Python code and results.

This assumes you have Jupyter installed. You will if you followed any one of the sets of instructions from the InstallingPython page.

Starting

If you are working with Anaconda, you can select Jupyter Notebook from the start menu.

If you are at a command line, you can start Jupyter with the command:

jupyter-notebook

Jupyter should open itself in your web browser automatically. At worst, you'll have to copy-and-paste the URL it gives you in the terminal window.

Working With A Notebook

From there, you can click a .ipynb file to open it, or create a new Python 3 notebook. You can rename the notebook file by changing the notebook's title at the top of the window.

The most odd thing about working in a Notebook is the way the Enter key behaves:

  • Enter: go to the next line of code in a cell.
  • Shift-Enter: execute the code in current cell.

To get started with notebooks, you could do a lot worse that the built in help: Help User Interface Tour, and Help Keyboard Shortcuts.

As you execute cells up and down the notebook, it's easy to have weird non-linear dependencies. It might be wise to double-check that everything runs as intended. You can do this by selecting Kernel Restart & Run All, or with the button in the toolbar.

Don't forget to save the notebook (File Save, or ctrl-S) before you leave. You can shutdown the process by pressing ctrl-C twice in the terminal window.

Updated Thu Aug. 22 2024, 10:14 by ggbaker.