Book Image

Learning Jupyter 5 - Second Edition

Book Image

Learning Jupyter 5 - Second Edition

Overview of this book

The Jupyter Notebook allows you to create and share documents that contain live code, equations, visualizations, and explanatory text. The Jupyter Notebook system is extensively used in domains such as data cleaning and transformation, numerical simulation, statistical modeling, and machine learning. Learning Jupyter 5 will help you get to grips with interactive computing using real-world examples. The book starts with a detailed overview of the Jupyter Notebook system and its installation in different environments. Next, you will learn to integrate the Jupyter system with different programming languages such as R, Python, Java, JavaScript, and Julia, and explore various versions and packages that are compatible with the Notebook system. Moving ahead, you will master interactive widgets and namespaces and work with Jupyter in a multi-user mode. By the end of this book, you will have used Jupyter with a big dataset and be able to apply all the functionalities you’ve explored throughout the book. You will also have learned all about the Jupyter Notebook and be able to start performing data transformation, numerical simulation, and data visualization.
Table of Contents (18 chapters)
Title Page
Packt Upsell
Contributors
Preface
Index

First look at Jupyter


Here is a sample opening page when using Jupyter (this screenshot is on a Windows machine):

You should get yourself acquainted with the environment. The Jupyter user interface has a number of components:

  • The product title, Jupyter, in the top left (as expected). The logo and the title name are clickable and will return you to the Jupyter Notebook home page.
  • There are three tabs which are displayed: Files, Running, and Clusters:
  • The Files tab shows the list of files in the current directory of the page (described later on in this section).
  • The Running tab presents another screen, which shows the currently running processes and Notebooks. The drop-down lists for Terminals and Notebooks are populated with their running members:
  • The Clusters tab presents another screen which displays a list of available clusters. This topic is covered in a later chapter:
  • In the top right corner of the screen, are three buttons: Upload, New (menu), and a Refresh notebook list button.
  • The Upload button is used to add files to the Notebook space. You may also just drag and drop as you would when handling files. Similarly, you can drag and drop Notebooks into specific folders as well.
  • The menu with New at the top presents a further menu of the Notebook for the different Notebook engines that have been installed (I had installed Jupyter earlier these are not default values) Javascript (Node.js), Julia 0.6.1, Python 2 (which will not be covered in this book), and Python 3. The additional Other menu items are Text FileFolder, and Terminal:
  • The Text File option is used to add a text file to the current directory. Jupyter will open a new browser window for you, running a text editor. The text entered is automatically saved and will be displayed in your Notebook files and directory display:

Note

The default filename, untitled1.txt, is editable. Note that the filename corresponds with the title given to the Notebook.

  • The Folder option creates a new folder with the nameUntitled Folder. Remember that all of the file and folder names are editable:
  • The Terminals option is used to open a new Terminal (command) window. The resulting display on a Windows machine looks as follows:
  • The Python 3 option is used to start a new Python 3 Notebook. The interface looks like it does in the following screenshot. You have full file editing capabilities for your script, including saving as a new file. You also have a complete working IDE for your Python script:

Note

Note, like the Text File and Folder option, you have created a Python script file in your Notebook and it is running! (You can see this in the home page display of Jupyter):

  • The Refresh notebook listbutton is used to update the display. It's not really necessary as the display is reactive to any changes in the underlying file structure.
  • At the top of theFilestab is a checkbox, a drop-down menu, and aHomebutton.
  • The checkbox is used to toggle all the checkboxes in the items list.
  • The drop-down menu presents a list of the choices available, that is, Folders, All NotebooksRunning, and Files, as shown in the following screenshot:
  • The Folders selection will select all the folders in the display and present a count of the folders in the small box.
  • The All Notebooks selection will change the count to the number of Notebooks and provide you with five options:
    • Duplicate (the selected Notebooks)
    • Shutdown (the selected Notebooks)
    • View (the selected Notebooks)
    • Edit (the selected Notebooks)
    • Delete (the trash can icon; the selected Notebooks)
  • You can see them in the following screenshot:
  • The Running selection will select any running scripts in the display and update the count to the number selected:
  • The Files selection will select all of the files in the Notebook display and update the count accordingly.
  • The Home button brings you back to the home screen of the Notebook.
  • On the left-hand side of every item is a checkbox, an icon, and the item's name:
  • The checkbox is used to build a set of files to operate upon.
  • The icon is indicative of the type of item. In this case, all of the items are folders.
  • The name of the item corresponds to the name of the object. In this case, the filenames are as they are when used on the disk.