0% found this document useful (0 votes)
11 views11 pages

Introduction to IPython and Jupyter Notebook

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views11 pages

Introduction to IPython and Jupyter Notebook

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

1

Lecture 1
IPython

Dr. S M Rafizul Haque, CSE, KU


2
Learning Objectives Today

 Understanding Python
 Understanding IPython
 Jupyter Notebook
 Help and Documentation in IPython
 Keyboard Shortcuts in the IPython Shell

Dr. S M Rafizul Haque, CSE, KU


Python and IPython
3  Python is a popular programming language. It was created by
Guido van Rossum and released in 1991.
 It is used for:
 Web Development (server-side)
 Software Development
 Mathematics
 System Scripting
 IPython (Interactive Python) is a powerful interactive Python
interpreter
 More interactive compared to IDLE (Python’s Integrated
Development and Learning Environment) and the standard
interpreter
Dr. S M Rafizul Haque, CSE, KU
Python and IPython
4  Ipython is a command shell for interactive computing in
multiple programming languages, originally developed for
the Python, that offers introspection, rich media, shell
syntax, tab completion, and history
 Key Differences Between IPython and Python
 Interactive Environment
 Rich Media Integration
 Notebook Architecture
 Additional Magic Commands
 Parallel Computing
 Extensibility and Integration

 Installing Ipython
 pip install ipython
Dr. S M Rafizul Haque, CSE, KU
IPython
5  What is Shell?
 The shell is a way to interact textually with computer

 Computers primarily were used to be controlled through sequences of text


input

 At the prompt, the user would type a command, and the computer would
do what the user told it to.

 Jupyter Notebooks
 A browser-based graphical interface to the IPython shell and builds on it a
rich set of dynamic display capabilities
 A community standard for communicating and performing interactive
computing
 As well as executing Python/ IPython statements, allows the user to include
formatted text, static and dynamic visualizations, images, mathematical
equations, JavaScript widgets, rich media representations of objects and
much more
Dr. S M Rafizul Haque, CSE, KU
Jupyter Notebook
6
 Installing the classic Jupyter Notebook
pip install notebook

 To run the notebook


jupyter notebook

 Installing JupyterLab
pip install jupyterlab

 Once installed, launch JupyterLab


 jupyter lab

Dr. S M Rafizul Haque, CSE, KU


Jupyter Notebook and Jupyter Lab
7  Components of a notebook
 A Jupyter Notebook consists of three main components: cells, a
runtime environment, and a file system.

 Cells are the individual units of the notebook, and they can contain
either text or code.

 JupyterLab is one interface used to create and interact with Jupyter


Notebooks.

 JupyterLab
 A next-generation web-based user interface for Project Jupyter.
 Enables to work with documents and activities such as Jupyter
notebooks, text editors, terminals, and custom components in a
flexible, integrated, and extensible manner.
Dr. S M Rafizul Haque, CSE, KU
IPython: Help and Documentation
8  Every Python object contains the reference to a string,
known as a docstring, which contains a concise summary
of the object and how to use it.

For example, to see the documentation of the built-in len() function:


In [1]: help(len)
Help on built-in function len in module builtins:
len(...)
len(object) -> integer
Return the number of items of a sequence or mapping

Dr. S M Rafizul Haque, CSE, KU


IPython: Help and Documentation
9
 IPython introduces the ? character to access this
documentation and other relevant information:

In [2]: len?
Type: builtin_function_or_method
String form: <built-in function len>
Namespace: Python builtin
Docstring:
len(object) -> integer

Return the number of items of a sequence or mapping

Dr. S M Rafizul Haque, CSE, KU


Jupyter Notebook: Common commands
10
 Navigation: Use Enter, Shift-Enter, Up/k, and Down/j

 Cell creation: Use a to insert a new cell above the current


cell, and b to insert a new cell below
 Cell editing: Use x, c, v, d, and z
 Cell deletion: Use d + d to delete the current cell
 Cell type change: Use m to change the current cell to
Markdown, and y to change it back to code
 Cell output toggle: Use Esc + O

 Find and replace: Use Esc + f

Dr. S M Rafizul Haque, CSE, KU


Jupyter Notebook: Common Commands
11
 Cell splitting: Use Ctrl + Shift + - to split the current cell
into two
 Cell running: Use Ctrl + Enter to run the selected cells,
Shift + Enter to run the current cell and move to the next
cell, and Alt + Enter to run the current cell and insert a
new cell below
 Cell selection: Use Ctrl + A to select all

 Cell undo: Use Ctrl + Z to undo

 Cell redo: Use Ctrl + Shift + Z or Ctrl + Y to redo

 Cell start: Use Ctrl + Home to go to cell start


 Cell
Dr. S M Rafizul Haque, CSE, KU
end: Use Ctrl + End to go to cell end

You might also like