Jupyter Notebook offers various advanced features, such as keyboard shortcuts, installing other kernels, executing shell commands, and using various extensions for faster data analysis operations. Let's get started and understand these features one by one.
Keyboard shortcuts
Users can find all the shortcut commands that can be used inside Jupyter Notebook by selecting the Keyboard Shortcuts option in the Help menu or by using the Cmd + Shift + P shortcut key. This will make the quick select bar appear, which contains all the shortcuts commands, along with a brief description of each. It is easy to use the bar and users can use it when they forget something:
Installing other kernels
Jupyter has the ability to run multiple kernels for different languages. It is very easy to set up an environment for a particular language in Anaconda. For example, an R kernel can be set by using the following command in Anaconda:
$ conda install -c r r-essentials
The R kernel should then appear, as shown in the following screenshot:
Running shell commands
In Jupyter Notebook, users can run shell commands for Unix and Windows. The shell offers a communication interface for talking with the computer. The user needs to put ! (an exclamation sign) before running any command:
Extensions for Notebook
Notebook extensions (or nbextensions) add more features compared to basic Jupyter Notebooks. These extensions improve the user's experience and interface. Users can easily select any of the extensions by selecting the NBextensions tab.
To install nbextension in Jupyter Notebook using conda, run the following command:
conda install -c conda-forge jupyter_nbextensions_configurator
To install nbextension in Jupyter Notebook using pip, run the following command:
pip install jupyter_contrib_nbextensions && jupyter contrib nbextension install
If you get permission errors on macOS, just run the following command:
pip install jupyter_contrib_nbextensions && jupyter contrib nbextension install --user
All the configurable nbextensions will be shown in a different tab, as shown in the following screenshot:
Now, let's explore a few useful features of Notebook extensions:
- Hinterland: This provides an autocompleting menu for each keypress that's made in cells and behaves like PyCharm:
- Table of Contents: This extension shows all the headings in the sidebar or navigation menu. It is resizable, draggable, collapsible, and dockable:
- Execute Time: This extension shows when the cells were executed and how much time it will take to complete the cell code:
- Spellchecker: Spellchecker checks and verifies the spellings that are written in each cell and highlights any incorrectly written words.
- Variable Selector: This extension keeps track of the user's workspace. It shows the names of all the variables that the user created, along with their type, size, shape, and value.
- Slideshow: Notebook results can be communicated via Slideshow. This is a great tool for telling stories. Users can easily convert Jupyter Notebooks into slides without the use of PowerPoint. As shown in the following screenshot, Slideshow can be started using the Slideshow option in the cell toolbar of the view menu:
Jupyter Notebook also allows you to show or hide any cell in Slideshow. After adding the Slideshow option to the cell toolbar of the view menu, you can use a Slide Type drop-down list in each cell and select various options, as shown in the following screenshot:
- Embedding PDF documents: Jupyter Notebook users can easily add PDF documents. The following syntax needs to be run for PDf documents:
from IPython.display import IFrame
IFrame('https://arxiv.org/pdf/1811.02141.pdf', width=700, height=400)
This results in the following output:
- Embedding Youtube Videos: Jupyter Notebook users can easily add YouTube videos. The following syntax needs to be run for adding YouTube videos:
from IPython.display import YouTubeVideo
YouTubeVideo('ukzFI9rgwfU', width=700, height=400)
This results in the following output:
With that, you now understand data analysis, the process that's undertaken by it, and the roles that it entails. You have also learned how to install Python and use Jupyter Lab and Jupyter Notebook. You will learn more about various Python libraries and data analysis techniques in the upcoming chapters.