Quantcast
Channel: Cloud Training Program
Viewing all articles
Browse latest Browse all 1891

Working with Jupyter Notebook

$
0
0

Jupyter Notebooks is a great environment for creating “code-heavy”. This blog post gives a walkthrough of the Step-By-Step installing Jupyter Notebook in your system. Furthermore, we’ll explore the basic functionality of Jupyter Notebook and we’ll try out how to write your first code in Jupyter Notebook.

The blog covers the following topics:

  • Differents types of Python IDEs
  • What is Anaconda?
  • What is Jupyter Notebook?
  • Step to install the Jupyter Notebook environment using Anaconda
  • How to run or open Jupyter Notebook?
  • How to run commands in Jupyter Notebook?

Differents Types Of Python Integrated Development Environments (IDEs)

Integrated Development Environments (IDEs) is software that bundles all the tools you use for writing and testing their programs, all wrapped in a neat toolkit. Each IDE includes different tools, but each includes a text editor to write code.

Code editors (CEs) are lightweight alternatives to IDEs.

Here are the most useful Integrated Development Environments (IDEs):

  1. PyCharm
  2. Visual Studio Code
  3. Sublime Text
  4. Atom
  5. Jupyter
  6. Atom and more…

IDEs

What Is Anaconda?

Anaconda is a free and open-source distribution of the Python languages for data science and machine learning-related applications. It can be installed on Windows, Linux, and macOS systems. Conda is an open-source, cross-platform, package management system. Anaconda comes with so very nice tools like JupyterLab, Jupyter Notebook, Spyder, Glueviz, Visual Studio Code.

Solve any data science problem with Anaconda:

  1. Neural Networks
  2. Machine Learning
  3. Predictive Analytics
  4. Data Visualization

Anaconda

What Is Jupyter Notebook?

JupyterLab is a web-based interactive development environment for Jupyter notebooks, code, and data. Jupyter Notebook is great for the following use cases: learn and try out Python, data processing, numeric simulation, Machine learning. It includes Python libraries included in Anaconda include NumPy, pandas, and Matplotlib, and more. It allows you to create and share documents that contain: Live code. Visualizations and more…

A very frequently asked question to us in our Live sessions & webinar is that what is the difference between Jupyter Notebook and Jupyter lab. So here are we are with the answer…

Jupyter Notebook is a web-based interactive computational environment for creating Jupyter notebook documents that supports several languages like Python, R, etc., and is largely used for data analysis, data visualization, and more.

JupyterLab is the next-generation user interface including notebooks. It has a modular structure, where you can open several notebooks or files (e.g. HTML, Text, etc) as tabs in the same window. It offers more of an IDE-like experience.

Now that we know what Jupyter Notebook is let’s see how we can install it and get started!

Steps To Install Jupyter Notebook

There are two ways to install the Jupyter Notebook.

1. Using the pip command

We can use pip to install Jupyter Notebook using the following command:

$ pip install jupyter

2. Anaconda

We can also use Anaconda, which is a Python data science platform. Anaconda has its own installer named conda that we can use to install Jupyter Notebook.

In this blog, we look at the steps to install Jupyter notebook using Anaconda.

Steps To Install The Jupyter Notebook Environment Using Anaconda

First, we need to install Anaconda by following the instructions given below.

Step 1: Go to browser type anaconda, Press Enter. The first link you see anaconda.com is visible, This official website Click on that, and here is it is.

Step 2: Click on pricing, Go to the bottom and You can see Individual Edition, It’s Freely available. Click on Learn more

Step 3: Now Click on Download

Step 4: Here we have successfully downloaded the Anaconda. Now, Click on the Arrow at the left bottom and then click on Open to install.

Step 5: Now, Click on Next 

Step 6: Now, you see below screen read teams of the agreement, Click on I Agree

Step 7: Now, for a single user, Click on Just me.

Note: In case you are setting up the environment for all the clients/users in your organization and want to have the same access then you can go for the All Users option.

Step 8: Here is the location of the installation is visible, If you want to change the location Click on Browser and you can set the location. I keep my location the same. Then click on Next

Step 9: If you don’t have Python installed on your System, then Make sure you have checked out Add Anaconda3 to my PATH environment variable.

This provides the flexibility to access the distribution of anaconda python anywhere from the PC. I already have python installed on my system. Click on Install.

Step 10: The installation will take a while depending on your system performance. Once the installation is completed, click on Next.

Step 11: Let’s just Uncheck this Anaconda Individual Edition Tutorial and Getting Started with Anaconda, Now click on Finish for installation.

Step 12: Go to the Search menu at the bottom and type anaconda Once installed, do a quick run of Anaconda Navigator and ensure it’s running fine.

Step 13: Close it for now.

Step 14: Now, Click on Anaconda Prompt 

Step 15: You can see below the command prompt, run the command to check the python –version, and to know more on Anaconda version Run command conda info

python --version

conda info

How To Run Or Open Jupyter Notebook?

Now that we have installed the Anaconda, we can open the Jupyter notebook.

Step 16: Now we Open Jupyter Notebook. Run the command Jupyter notebook.

jupyter notebook

Jupyter Interface

The web server is started and the Jupyter Notebook application is opened in your default browser automatically. You should be able to see a browser output that is similar to the following screenshot:

As you can see the user interface of Jupyter Notebook is split up into three sections (tabs):

  • Files
  • Running
  • Clusters

The default view is the Files tab from where you can open or create notebooks.

Keyboard shortcuts:

The essential shortcuts to remember are the following:

  • Enter: Edit mode, In edit mode, you can edit the text in cells.
  • Esc: Command mode, In command mode, you can navigate around the notebook using keyboard shortcuts.
  • Shift-Enter: Run cell, Execute the current cell, show any output, and jump to the next cell below.

Step 17: Creating a new Jupyter Notebook is easy. Just use the New dropdown menu and you’ll see the following options, Select option Python3 to open a new Jupyter Notebook for Python.

How To Run Commands In Jupyter Notebook?

Cells in a notebook: Cells are the building blocks of a notebook. Anything we do in a notebook, we do it within a specific cell block. There are two types of cells in a notebook:

  • Code cell. These cells contain the code that will be executed in the kernel. When the notebook is executed, the resulting output will be shown below the code cell (outside the cell).
  • Markdown cell. These cells contain the text content using Markdown. At the runtime, the result will be generated at the place of the markdown cell.

Step 18: This is the environment of Jupyter Notebook

Step 19: Change the name of the Notebook to My first Notebook

Step 20: You can see your Notebook name, and code cell. Run the following commands: 

#single word
"Hello!! welcome to my first Notebook"

Step 21: It is the last step, Click on Logout 

Jupyter Notebook gives you several options to export your notebook. Those options can be found in menu File → Download as:

This was a beginner’s guide to get started with python on Jupyter notebook.

Related References:

Next Task For You…

Python’s growth is very promising in the near future. Gaining the right skills through the right platform will get you to the perfect job.

We are launching our course Python For Data Science (AI/ML) & Data Engineers (Python For Beginners) which will you help and guide you towards your first steps to Python.  Join our Waitlist to know more about it.

Python For Data Science (AI/ML) & Data Engineers

The post Working with Jupyter Notebook appeared first on Cloud Training Program.


Viewing all articles
Browse latest Browse all 1891

Trending Articles