Tutorial on Using Jupyter (IPython) Notebook

When working on tasks that involve numerical simulation, statistical modelling, data processing, or machine learning, many professionals prefer Jupyter as their go-to application. Jupyter is an open-source software developed and maintained by the non-profit Organisation Jupyter, which began as a part of the IPython Project in 2014. It is available for download free of charge, and supports programming languages including Julia, Python, and R – hence its name.

This article will walk you through the process of setting up your own local version of the Jupyter (IPython) Notebook and running it without the need to connect to a server. Additionally, we will provide some useful tips for creating a notebook, adding data, exporting it to other platforms, enhancing it, and much more.

What is meant by the term “Jupyter (IPython) Notebook”?

Jupyter Notebook, previously known as IPython Notebook, is a user-friendly web application that provides a platform for developing and sharing documents that incorporate live code, equations, visualisations, and text. This application allows users to create and distribute documents that effectively blend the computational power of scripting languages with the narrative force of formatted text, equations, and visualisations. Whether it is for data cleaning and transformation, numerical simulation, statistical modelling, machine learning, or any other purpose, Jupyter Notebook can be a great asset to professionals in many fields.

  • Ciphers in use
  • Equations
  • Visualisations
  • A narrative or tale.

When used properly, the Jupyter Notebook can be an extremely valuable tool. It is versatile enough to handle a wide variety of activities, from data storage and transfer to facilitating the learning and teaching of programming languages such as Python.

Section 1: Getting Started

If you wish to use the Jupyter Notebook along with Python, you’ll need to download Python and then manually install the Jupyter Notebook. For guidance on accomplishing this, please refer to the following instructions:
Visit the project’s official homepage at https://jupyter.org/.

If you are ready to proceed, you have two options: you can either install the Notebook and try it out in your browser.

Test it out in your browser: If you’d rather not install the program onto your device, you can opt for the hosted version of the Jupyter Notebook. This option enables you to access the program without requiring any installation on your hardware.
Computer Setup for the Notebook: Clicking on this option will redirect you to a separate website where detailed instructions for setting up your device are provided.

Now it is time to select one of the two described methods for installing the program onto your computer. These methods are outlined in greater detail below.

  • Installing the Jupyter Notebook (CPython) via Python’s package manager, pip
  • In order to install the program, users can leverage the Anaconda distribution installation process.

If you are new to Python, it is advisable to take the second option.

To obtain Anaconda, visit this page, where you’ll find the correct installers for Windows, macOS, and Linux. The links provided are optimised to enhance the installation process for each of the relevant operating systems.

When you install Anaconda on your computer, you are granted access to a multitude of scientific libraries-including the Jupyter Notebook-without the need for any additional software. This makes Anaconda an all-inclusive and convenient solution for your data science requirements.

The next step is to launch the server for the Jupyter Notebook.

Now that you have the Anaconda distribution installed, it’s time to get started.

  • Open the terminal and navigate to your preferred directory.
  • In the terminal, navigate to your desired location (the folder, or subfolder if applicable), and then run the following command:
    jupyter notebook $

You should now see Jupyter opening.

Next, create the Jupyter Notebook.

Now that you know how to initiate the Notebook server, you can proceed with creating your own working Jupyter Notebook.

  • Click on the applicable button to access the “New” submenu.
  • Select “Python 3” by ticking the adjacent box to use this version.
  • A new Python notebook will be created.

Fourthly, provide a title for the notebook.

  • To change the file name, click on the word “untitled” located in the document’s header.
  • After choosing a suitable name for the file, remember to save it using the .ipynb extension.

You should now have the file open, which is indicated by the Running status visible at the top. If you wish to exit the same, simply click on the Shutdown button.

Step 5: Cellular Processes

  • Cells make up the notebook and once you create a new one, the first blank page can be used immediately.
  • You can simply type in the Python code as plain text.
  • By pressing the run cell button or using Shift + Return, the code in the current cell will be executed.
  • The output will be displayed in a cell just below the input.
  • Once you run the code, the system will automatically generate a new blank cell for you to use. If necessary, you may add more code to the newly created cell.

Step 6: Adding Descriptive Text

  • If you want to include descriptive text in your notebook, you will need to switch the cell type from Code to Markdown.
  • Once the cell’s type has been changed, you can type in the markdown code and compile the cell by pressing the Shift + Return keys.
  • The output of the markdown code will be displayed in the cell that was previously used as the markdown editor.

Step 7: Switching between Editing and Command Modes

If a cell is selected, it will be in one of two modes: command mode or edit mode.

  • If you double-click a cell, it will enter Command mode, which can be recognized by the blue shade on the left margin.
  • Clicking on the code area of the cell will shift it to edit mode, noticeable by the green outline on the left side of the page.
  • Pressing the ESC key will navigate you back to the Command mode.
  • If you wish to view a complete list of keyboard shortcuts available in both modes, navigate to Help > Keyboard shortcuts.

Step 8: Checking the Progress

Jupyter Notebook offers checkpointing as a valuable feature to its users. This allows users to save a snapshot of their notebook at any point, making it possible to undo any changes made after that point and restore the notebook to its previous state.

  • To save your progress and create a new checkpoint, click on File followed by Save and Checkpoint from the main menu.
  • After performing the above action, a checkpoint is added to the notebook, and the file is saved.
  • If you wish to revert to the checkpoint later on, select File > Revert to Checkpoint.

Step 9: Exporting the Notebook

  • To save the notebook onto your computer, navigate to File and click on Download as.
  • There are several downloadable file types available, including .ipynb and .pdf. Choose the file format that best fits your requirements.

By now, you should be able to create your own Jupyter Notebook and use it for all your future Python projects.

If you wish to share your notes with others, you could consider converting them into a slideshow or uploading them to GitHub. This will enable others to read and comment on your notebook without having to install it. Additionally, you can also make use of a binder that enables users to access your notebook without any installation.

Join the Top 1% of Remote Developers and Designers

Works connects the top 1% of remote developers and designers with the leading brands and startups around the world. We focus on sophisticated, challenging tier-one projects which require highly skilled talent and problem solvers.
seasoned project manager reviewing remote software engineer's progress on software development project, hired from Works blog.join_marketplace.your_wayexperienced remote UI / UX designer working remotely at home while working on UI / UX & product design projects on Works blog.join_marketplace.freelance_jobs