Jupyter Notebook

 Introduction to Jupyter Notebook

Project Jupyter - Wikipedia

A Jupyter Notebook is an open source web application that allows data scientists to create and share documents that include live code, equations, and other multimedia resources.

Use of Jupyter Notebook:

Jupyter notebooks are used for all sorts of data science tasks such as exploratory data analysis (EDA), data cleaning and transformation, data visualization, statistical modeling, machine learning, and deep learning.

Advantage of Using Jupyter Notebook:

  • Useful for "showing the work" through a combination of code, markdown, links, and images.
  • Jupyter notebooks can also be converted to a number of standard output formats (HTML, PowerPoint, LaTex, PDF, Restructured Text, Markdown, Python)

Working of Jupyter Notebook

Step 1) Open Jupyter Notebook from apps.
step 2) In your default browser a web page will open like this and default directory will be C drive of your system.

 

Step 3) If you want to run and save your code in other directory then follow these steps:

  1. Open Anaconda Prompt (anaconda 3) from start menu.
  2. Type the directory name followed by colon (:) and then press Enter (Example - d:)
  3. Type Jupyter notebook and then Enter.

Step 4) Open your preferred folder and then click on New -> Python 3.

Step 5) A new notebook will be opened with name 'Untitled.ipynb' and you can run your code here.

Commands and Shortcut of Jupyter Notebooks

Action                                           Menu                                             Keyboard Shortcut 

Run selected cells                            Cell -> Run Cells                            Ctrl + Enter

Run the current cell and go down,     Cell -> Run Cells and Select Below,        Shift + Enter


Save and checkpoint                           File -> Save and Checkpoint                    Ctrl + S


Insert cell above                                  Insert -> Insert Cell Above                            A


Insert cell below                                  Insert -> Insert Cell Below                         B


Change the cell type to Code,            Cell -> Cell Type -> Code                            Y


Change the cell type to Markdown,    Cell -> Cell Type -> Markdown,               M


Code completion or indent                                                                                     Tab


How to run .py file from Terminal

Spyder
Spyder IDE - Home | Facebook

Steps to Run. py scripts

  1. Open Spyder from apps installed in your system.
  2. Write and save code in your preferred directory, it will be saved as .py extension.
  3. Open Anaconda Command Prompt.
  4. Go to the directory in which you have saved the .py file using below command cd path_to_directory
  5. Run your script using below command: Python Scriptname.py
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4841117896460511" crossorigin="anonymous"></script>





 

Action

Menu

Keyboard Shortcuts

Run selected cells

Cell -> Run Cells

Ctrl + Enter

Run the current cell and go down

Cell -> Run Cells and Select Below

Shift + Enter

Save and checkpoint

File -> Save and Checkpoint

Ctrl + S

Insert cell above

Insert -> Insert Cell Above

A

Insert cell below

Insert -> Insert Cell Below

B

Change the cell type to Code

Cell -> Cell Type -> Code

Y

Change the cell type to Markdown

Cell -> Cell Type -> Markdown

M

Code completion or indent

 

Tab






Comments

Data science

Introduction to Data Science?

What is Python?

How to run Google Colab?