Jupyter Notebook extensions have become popular among data scientists as it extends the functionality of the notebook to simplify various tasks right from code completion to displaying execution time and changing the theme. One of the reasons why IDEs such as PyCham and VS Code are embraced by data scientists is due to the fact that it allows programmers to add numerous features with plugins/extensions. However, you can add similar extensions on Jupyter Notebook with only a few lines of command to have a smooth and rich experience while programming.
We have listed down extensions that you must add to your Jupyter Notebook to simplify your programming workflows: –
Sign up for your weekly dose of what's up in emerging technology.
nbextensions is a plugin manager that allows you to enable and disable extensions with just a few clicks, thereby eliminating the need for executing commands for activating and deactivating add-ons. Apart from managing the extension, nbextensions comes with a wide range of plugins, which are added while installing nbextensions.
Run the below command to install the nbextensions: –
conda install -c conda-forge jupyter_contrib_nbextensions
You can check the addition of nbextensions after starting the notebook at the bottom of the edit tab.
Note: In some cases, you might already have nbextensions installed.
Open the nbextensions and search and enable Hinterland. This extension helps in autocompleting the code. Without this, you would require to press tab and check for the available options for code completion. However, Hinterland enables the autosuggestion as you type. You can also configure the behaviour of the extension such as hint delay, hint inside comments, and more. The parameters can be changed from the nbextensions menu.
3| Execute Time
This extension is a part of the nbextensions and can be activated to get insights into the time your cell took to run. Besides, it shows the date the cell was last executed. As a data science practitioner, it is essential to optimise the code to run faster. Since this extension provides you with the time your code takes to execute, you can optimise the code depending on the requirements. Although the execution time of a cell can be checked with magic commands, this extension will by default show the time and save you a few keystrokes as you won’t require to add the magic command every time.
Snippets allow you to quickly add new lines of codes for common tasks such as creating an array with NumPy, scientific calculation with SciPy, and even visualise with matplotlib. You can use snippets for multiple reasons: check the syntax of a technique or implement statistical methods that you might have forgotten.
5| Table Of Contents
On adding ‘table of contents’ extension, you can organise your notebook with index to move effortlessly within the notebook. Often data scientists use the markdown feature of the notebook to document as they gradually progress with their data analysis. This not only makes it easy to relook at the flow of the process but also help others to understand your methodologies effectively.
6| Collapsible Headings
Since data analysis can go up to a few hundred to thousands of cells depending upon the nature of data and the objective of the analysis, you can struggle to quickly move from one section to another. To mitigate his, you can enable Collapsible Headings to hide certain processes of your analysis. For this, you will have to add proper headings. As the name suggests, it collapses the headings and not the cell that you wish for. However, you can add headings in a way that you can hide the required cells, i.e. the cells between headings can be clubbed under one heading.
Qgrid is not a part of the nbextensions, thus you will have to install it with command. It will empower you to explore pandas’ DataFrame with a few clicks. You can sort and add filters to the columns, scroll across the length of the table, and edit the cells. With Qgrid, one can explore the entire data visually without writing codes.
To install Qgrid, use the below command in you Anaconda Prompt: –
conda install qgrid
8| Jupyter Themes
Jupyter theme extension allows you to beautify not only the plain white background of your Jupyter Notebook but also the fonts of text and size of cells. In addition, you can plot appealing visualisations using the
style() method. Jupyter themes extension doesn’t come with nbextensions, and you need to install them using the below command: –
conda install -c conda-forge jupyterthemes
To know more about jupyterthemes, click here.