Getting Started with the IPython Notebook

Reading Time : ~ .

IPython Notebook

* Until now we have worked directly via the interactive Python console, or by writing Python programs. IPython is a set of tools developed to make it easier for the programmers to work with Python and data.

* IPython is an enhanced Python shell, the shell being the prompt which appears when you start the python command in your terminal.

* IPython comes with notebook flavor that lets you write and execute code, analyze data in your web browser, embed content and share the work.

* IPython provides extensions to the Python programming language that make working interactively convenient and efficient. These extensions are implemented in the IPython Kernel and are available in all of the IPython Frontends (Notebook, Terminal, Console and Qt Console) when running this kernel.

Installing IPython Notebook

    $ sudo apt-get install ipython-notebook python-matplotlib

Or if you want to install using 'pip', then you can install IPython as follows:

    $ pip install ipython[notebook]

Starting IPython

To start IPython in terminal:

    $ ipython

Starting IPython Notebook

* You can interact with IPython Notebook using your web browser. You can start IPython Notebook from the command line.

* First open a terminal window, then navigate to the directory where you want to store your Python and notebook document files. Then run this command:

    $ ipython notebook or jupyter notebook

* Once IPython is running sucessfully, a browser window will automatically open or point your web browser at http://localhost:8888 to start using IPython notebooks.

First Steps with Notebook

* In the browser, click on "New Notebook" button to create a notebook. This opens a new browser window with new notebook and you can change the title by clicking on 'Untitled' on top of the page.

* An IPython notebook is made up of a number of cells. The empty box at the top is the first "cell" for entering Python code.

* You can enter set of Python statements like 'print("Hi")' in the cell and to run the code in the cell, click on 'Run' icon or press Shift+Enter.

* The output of code is displayed right after the cell. And you can see a new empty cell.

* IPython Notebooks are saved as IPython Notebook files (File extension .ipynb).

Loading Notebook Files

* You can also load IPython Notebooks files saved with '.ipynb' extension. You just need to add/move the file into your IPython Notebook directory and then choose Open file to open it.

Loading/Running Python Files

* You can load existing python files in to notebook cells by using

    $ %load ""

and run the cell. This loads the entire file contents in to the cell.

* And you can also directly run the python file like

    $ %run ""

This will run '' and displays the output.

    By Posted On

Need any Help in your Project?Let's Talk

Latest Comments
Related Articles
python class special methods or magic methods Anjaneyulu Batta

python class special methods or magic methods. magic methods allow us to override or add the default functionality of python objects. One of the biggest ...

Continue Reading...
Python Coding Techniques and Programming Practices Anjaneyulu Batta

Coding techniques and programming practices are one of the features of a professional programmer. While writing code to solve a problem programmer should make simple ...

Continue Reading...
Working with python collections part 1 Rakesh babu Podishetty

Python Collections - named tuple is to access by the names specified and deque is to append and pop the elements from both sides of ...

Continue Reading...

Subscribe To our news letter

Subscribe to our news letter to receive latest blog posts into your inbox. Please fill your email address in the below form.
*We don't provide your email contact details to any third parties