A data scientist would agree that you can barely do without using a Jupyter notebook at some point in time, well, if not every time. A wide range of AI/ML engineers has adopted the use of Jupyter Notebook as a tool they use to write and test the algorithms/models. But what is Jupyter? And why is it referred to as a Notebook? So basically, we could say a notebook is used to express a particular context, idea, or knowledge using text, diagrams, drawings, pictures, equations, tables, or even charts. Why then is Jupyter referred to as a notebook? Because it does exactly what the above stated does! It is used to draft out documents, codes, texts, pictures, equations, draft charts, and visualizations and even draw tables.

What is Jupyter Notebook?

The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. It uses include data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more. Most often, the Jupyter Notebook is used in a Python environment. They have very interactive outputs and can be easily shareable, just like a regular notebook.

What can Jupyter Notebook be used for?

Writing multiple languages. The Jupyter system supports over 100 programming languages (called “kernels” in the Jupyter ecosystem), including Python, Java, R, Julia, Matlab, Octave, Scheme, Processing, Scala, and many more. You can share the code written in Notebook with others. Here are a few languages that can be written in Jupyter notebook.

Python

Of all languages that can be written with Jupyter, python is the most popular with the notebook. Almost everyone that writes code within the Jupyter environment writes the Python. By default, Jupyter supports Python in their environment without the use of special magic commands. And, the output would be:

JavaScript

JavaScript popularly known for the web and can also be written in Jupyter. Unlike Python, JavaScript isn’t supported by default. You have to use a certain special command to tell the cell you’re running it in that this is a JavaScript code. These commands are often called magic commands. for JavaScript, the command is %%javascript. There is also a limit to what JavaScript code you could run in Jupyter Notebook, unlike python.

Java

It allows integrating additional “kernels” – languages. Such a kernel can be installed by following the set of installation instructions here. After installing, run the following command in your Jupyter terminal if on Linux.

Matlab

Matlab is a high-performance language for technical computing; It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. To use Matlab in Jupyter Notebook, you first have to install Jupyter-Matlab. The first thing we need to do is to create a virtual environment.

Open your Jupyter prompt on windows or just your terminal on Linux and type in the following command

Make sure you remain in this terminal, then type the code

Then install Matlab kernel for Python

Check if the kernel is properly installed

Find your MATLAB directory.  “/Applications/MATLAB_R2017a.app”. Go to the “extern/engines/python” subdirectory and install the Python engine.

Start Jupyter notebook

Once launched, there should now be an option for both Matlab and python.

Markdowns

Jupyter notebook comes in handy when it comes to writing markdown, and this can be very useful when you want to give a verbose or well-detailed explanation of a piece of code, write documentation, or a dictionary for a particular dataset. Type the below code in a notebook. The output should be as follows;

Bash Scripts

Jupyter Notebooks allows the use of bash script by using the %%bash magic command. To test, let’s create a folder in your current working directory. Type the following code in a Notebook cell. Run the code, now check your working directory by typing the code You will see that the folder Test_Folderhas been added to it. You can also navigate to the folder physically to check.

Data Visualization

With the use of Python libraries like matplotlib, you can run and display data visualizations right in your browser. Let’s try to make a very basic visualization using matplotlib. We would first import the library Then type in the following codes Even more intriguing is we could do 3d visualizations!! We first need to import the 3d visualization library Then make a 3d projection Our output should look like this Now, run the following scripts.

Mathematical And Scientific Notations

We can use tools like Latex right inside our Jupyter Notebook type mathematical and scientific equations. LaTeX is a high-quality typesetting system; it includes features designed for the production of technical and scientific documentation. You can learn more about latex here here. Let’s try to run some simple LaTex codes. Type in the following LaTex commands Conclusion

This article just scratches the surface of what could be achieved with the use of Jupyter notebooks. You can find most of the examples in this article in this Jupyter notebook I created here on collaboratory

Jupyter Notebook Introduction for Beginners - 25Jupyter Notebook Introduction for Beginners - 44Jupyter Notebook Introduction for Beginners - 40Jupyter Notebook Introduction for Beginners - 45Jupyter Notebook Introduction for Beginners - 78Jupyter Notebook Introduction for Beginners - 36Jupyter Notebook Introduction for Beginners - 74Jupyter Notebook Introduction for Beginners - 83Jupyter Notebook Introduction for Beginners - 17Jupyter Notebook Introduction for Beginners - 3Jupyter Notebook Introduction for Beginners - 54Jupyter Notebook Introduction for Beginners - 63