loader image
Skip to main content

Section outline

    • Welcome to the “Introduction to Jupyter Notebook” course. This free course, designed for beginners, takes approximately 45 mins to complete and provides a foundational understanding of Jupyter Notebook. No prior knowledge of the subject is required.

      This course will help you to:

      • Understand what Jupyter Notebook is and its key features and benefits.
      • Navigate the Jupyter Notebook interface with ease.
      • Use notebook cells effectively, including writing and executing code and using Markdown for documentation.
      • Perform basic operations, including running and debugging code and using keyboard shortcuts.
      • Collaborate and share notebooks efficiently, leveraging best practices.
      • Organise your notebooks and troubleshoot common issues.  

      By the end of this course, you will be well-prepared to interact with Jupyter Notebooks confidently, setting a strong foundation for more advanced data analysis and visualisation courses.

      TO ENROL - use the key "CSData"

      This course is part of the “Data Analysis and Visualization” learning path, which includes the following courses:

      1. Introduction to Jupyter Notebooks
      2. Introduction to Python
      3. Introduction to NumPy
      4. Introduction to Pandas
      5. Data visualization in Python

      These courses are designed to be taken in sequence to build a solid foundation in data analysis and visualization.

        • In this course, we will teach you how to use a tool that is called "Jupyter Notebook". The reason to learn this tool is that it is a web-application that we will use throughout the learning on how to do data analysis with Python (the programming language that we will learn in the next lesson). Once you know how to use Jupyter Notebook at a basic level, we can go on to teach you programming for data analysis. Let's start

          Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code (that means that you write programming code and then run or execute it in the browser and see the results), equations, visualisations, and narrative text. It was originally developed as part of the IPython project and has since become a cornerstone tool in data science and interactive computing.

          Key Features and Benefits:

          1. Interactive computing: Jupyter Notebooks allow you to write and execute code in an interactive environment. This means you can run code cells one at a time and immediately see the results, making it easier to debug and understand code.
          2. Support for multiple languages: Although Jupyter was initially designed for Python, it supports over 40 programming languages, including R, Julia, and Scala (other programming languages that are being used in data science), through various kernels. This makes it a versatile tool for different types of projects.
          3. Rich text capabilities: Notebooks support Markdown, which is a form of writing text that the computer can interpret and turn to formatted text, images, links, and equations alongside your code. This is particularly useful for creating comprehensive documentation of the work that you carried out and tutorials (like this one!).
          4. Visualisation integration: Jupyter integrates well with popular data visualisation libraries like Matplotlib, Seaborn, and Plotly (we will learn some of them in our 5th lesson), allowing you to create interactive and static plots directly within the notebook.
          5. Extensibility: The Jupyter ecosystem includes a variety of extensions and plugins that can enhance functionality, such as interactive widgets, code formatting tools, and more.
          6. Sharing and collaboration: Jupyter Notebooks can be easily shared and published. They can be exported to different formats such as HTML, PDF, and slideshows. Additionally, platforms like GitHub (for storing code) and nbviewer provide straightforward ways to share notebooks with others.
          7. Reproducibility: Because notebooks combine code, data, and narrative text in a single document, they promote reproducible research. Anyone with access to the notebook can reproduce the analysis and results step-by-step.
          8. Educational use: Jupyter Notebooks are widely used in education for teaching programming, data science, and other subjects. Their interactive nature makes them an excellent tool for creating hands-on learning experiences. This also means that you can find other people around who know these tools and can help you if you are stuck. 

          Screenshot of a real Jupyter Notebook

          This dynamic and interactive environment is particularly powerful for educational purposes, especially in programming and data visualisation courses.

          One of the primary advantages of using Jupyter Notebooks in education is the interactive learning experience they provide. Unlike static documents or textbooks, Jupyter Notebooks allow learners to write and execute code in real-time. This immediate feedback loop is crucial for learning programming, as it helps learners quickly identify and correct mistakes, enhancing their understanding and retention of the material.

          The ability to use Markdown cells alongside code cells allows for comprehensive documentation within the notebook. You can integrate explanations, notes, and visual aids directly into their notebooks, making learning materials more engaging and easier to follow. Additionally, Jupyter Notebooks support a wide range of multimedia content, including images, videos, and interactive visualisations, which can help illustrate complex concepts more effectively. Moreover, another significant benefit is resource efficiency. Since Jupyter Notebooks can be accessed and run through a web browser, learners only need internet access to use them. They do not require powerful personal computers, as the computational resources are provided by the server hosting the JupyterHub. This accessibility ensures that all learners, regardless of their hardware capabilities, can participate fully in the coursework.

          For data visualisation courses, as in our case, Jupyter Notebooks are invaluable. They integrate seamlessly with libraries like Matplotlib, Seaborn or GGPlot, allowing learners to create and interact with visualisations in real-time. This hands-on approach to learning data visualisation techniques not only enhances understanding but also helps learners develop practical skills they can apply in real-world scenarios.

    • As you progress through this and the subsequent data courses, we will leverage all the benefits of Jupyter Notebook. You will have direct access to the Notebooks for each section. But, before you access the first Notebook, here’s a brief explanation of how they work:

      A descriptive image of the Jupyter Notebook interface

      1.  Menu bar: The menu bar at the top of the interface provides access to various operations:
         • File operations: Create new notebooks, open existing ones, save your work, and more.
         • Edit options: Cut, copy, paste cells, and undo changes.
         • View settings: Toggle the visibility of elements like the toolbar and header.
         • Run menu: Run, stop, insert, change the type of cells.
         • Kernel menu: Manage the notebook’s computational engine, including restarting it. The computational engine is the part that run the code that you are writing in the notebook.
         • Tab menu: Manage the tabs of your different notebooks.
         • Settings menu: Access to the configuration of the different general options of the environment: language, autosave, font size...
         • Help menu: Access documentation and support resources.
      2. Toolbar: The toolbar provides quick access to common actions:
         • Save: Save your notebook (Ctrl + S or Cmd + S on Mac).
         • Add cell: Add a new cell below the current one (+ button).
         • Cut/Copy/Paste cells: Manage cells easily.
         • Run cells: Execute the code in the selected cell (Shift + Enter)
         • Interrupt the kernel: Stop the notebook’s computational engine.
         • Restart the kernel: Restart the notebook’s computational engine.
         • Restart the kernel and run the cells: Restart the notebook’s computational engine and run every cell of the notebook.
         • Change the cell typeChange the type (Markdown or Code) of the selected cell.
      3. Markdown cells: Markdown cells are used to add formatted text, making it easy to include documentation, explanations, and links within your notebook. Markdown supports headings, lists, links, images, and more. Think of these cells as the places where you can write different things and present them. 
         • Writing markdown: Select a cell, change it to Markdown (using the toolbar or by pressing M), and write your formatted text.
         • Rendering markdown: To render the Markdown text, press Shift + Enter.
      4. Code cells: Code cells are used to write and execute code. When you run a code cell, the output is displayed directly below the cell. This allows you to see the results of your code immediately.
         • Running code: Click on the cell and press Shift + Enter, or click the Run button in the toolbar.
         • Output: The results of the code execution appear below the code cell.
      5. Output: The output of a code cell is the result generated from the execution of the code. This output is displayed directly below the code cell and can include various types of results such as text, images, plots, or interactive elements. For example, executing a code cell containing a print statement will display the printed text below the cell, while executing a cell with a plot command will render the plot in the output area (as in the image).
    • In this section you will be introduced to a Jupyter Notebook for the first time, allowing you to navigate through it, edit its contents and gain a better understanding of its functionality and potential.

      Learning Objectives:

      • Learn how to run and debug code in Jupyter Notebook.
      • Understand and utilise keyboard shortcuts and magic commands.
      • Perform basic file operations within a Jupyter Notebook.

        

      To continue, access the Notebook by clicking on the icon of the Jupyter notebook below.

    • In this section, you will learn essential best practices for interacting with Jupyter Notebooks and how to troubleshoot common issues. These guidelines will help you navigate through the provided Notebooks effectively, ensuring a smooth and productive learning experience.

      Learning Objectives:

      • Follow best practices for running and organising cells within a Jupyter Notebook.
      • Learn how to import necessary libraries and understand the significance of doing so.
      • Troubleshoot common issues that may arise while working with Jupyter Notebooks.

        

      To continue, access the Notebook via the following link: