• Stars
    star
    203
  • Rank 192,890 (Top 4 %)
  • Language
    Python
  • Created over 11 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

UPDATE (2015): This is an old repo, go here for the new edition

UPDATE (2015): This is an old repo, go here for the new edition

Examples from the IPython mini-book

This repository contains all code examples from the book Learning IPython for Interactive Computing and Data Visualization, Packt Publishing, by Cyrille Rossant.

Book overview

This book is a beginner-level introduction to IPython for interactive Python programming, high-performance numerical computing, and data visualization. It assumes nothing more than familiarity with Python. It targets developers, students, teachers, hobbyists who know Python a bit, and who want to learn IPython for the extended console, the Notebook, and for more advanced scientific applications.

The book first introduces IPython for interactive Python and shell programming. It shows how IPython can considerably improve the productivity of a developer who creates, debugs, benchmarks and profiles Python code.

Then, the reader learns the very basics of vector computing, and discovers how to load and analyze numerical and tabular data with NumPy and Pandas. The book shows the interactive visualization capabilities of the platform with Matplotlib, SciPy and PIL. It also contains a few image processing examples.

Some techniques to accelerate Python code are also demonstrated, using either interactive parallel computing features from IPython (using MPI or not), or Cython to compile a portion of the code in C for really interesting speedups.

Finally, the book shows how IPython can be customized for advanced uses, notably with the creation of new extensions and magic commands.

Code examples

Most files are IPython notebooks (.ipynb extension with JSON data). There are also some Python external scripts (.py extension).

The following modules are used in at least one example:

  • Python 2.7
  • IPython 0.13+
  • NumPy
  • Pandas
  • SciPy
  • Matplotlib
  • Matplotlib basemap
  • NetworkX
  • PyQt or PySide
  • Cython
  • PIL

You can view the notebooks in the IPython notebook viewer (see links below).

Chapter 2: Interactive Work with IPython

  • Example 1. We download and extract a social graph dataset (ego graphs of anonymous Facebook users, obtained on the SNAP project from Stanford University). This example illustrates how to interact with the filesystem from IPython.

  • Example 2. Here we explore with IPython the dataset downloaded in the previous example.

  • Example 3. We use the NetworkX package to process social graphs. We show how to explore simultaneously the data and a new Python module as well in an IPython interactive session.

Chapter 3: Numerical Computing with IPython

  • Example 1. We introduce here the very basics of vector computing and NumPy multidimensional arrays. We show with a simple example what performance gains we can expect by using NumPy instead of pure Python loops.

  • Example 2. We generate multiplication tables with different methods, showing the performance benefits of using vectorized computations and broadcasting.

  • Example 3. We download and analyze a new dataset containing the geographical coordinates of all cities in the world, as well as the population for some of them. This free dataset has been created by MaxMind.

Chapter 4: Interactive Plotting and Graphical Interfaces

  • Example 1. This is a short introduction to the most basic plotting features of Matplotlib.

  • Example 2. We use the world cities dataset from the previous example to create a human density world map with SciPy and Matplotlib.

  • Example 3. We show how to plot histograms of social data.

  • Example 4. We show a few customization options with Matplotlib.

  • Example 5. We show how to use PIL and SciPy for some basic image processing algorithms.

  • Example 6. This is a 3D plot example with Matplotlib.

Chapter 5: High Performance and Parallel Computing

  • Example 1. We demonstrate the most basic interactive parallel computing features of IPython.

  • Example 2. We show how Monte Carlo simulations can be parallelized with IPython.

  • Example 3. This is a simple MPI example executed from an interactive IPython session.

  • Example 4. We show how an imperative algorithm (Sieve of Eratosthenes) implemented in Python can be accelerated with Cython.

  • Example 5. We show how to use Cython with NumPy-based algorithms for dramatic speed improvements.

Chapter 6: Customizing IPython

  • Example 1. We show how to load IPython extensions, with an application to line-by-line profiling of Python code.

  • Example 2. We show how to create a new IPython extension. As an example, we create a very basic extension for writing and executing C++ code in the IPython notebook.

  • Example 3. We illustrate the rich display features of the IPython notebook.

More Repositories

1

awesome-math

A curated list of awesome mathematics resources
Python
7,684
star
2

ipymd

Use the IPython notebook as an interactive Markdown editor
Python
479
star
3

awesome-scientific-python

A curated list of awesome scientific Python resources
Python
194
star
4

galry

[deprecated] High-performance interactive visualization in Python
Python
187
star
5

smopy

OpenStreetMap image tiles in Python
Python
161
star
6

ipycache

Defines a %%cache cell magic in the IPython notebook to cache results of long-lasting computations in a persistent pickle file
Python
139
star
7

playdoh

UNMAINTAINED - USE AT YOUR OWN RISKS
Python
67
star
8

euroscipy2014

IPython advanced tutorial: introducing the interactive features of the IPython Notebook
43
star
9

h5view

Command-line tool in Python to explore a HDF5 file
Python
19
star
10

programming-yin-yang

A list of antonyms commonly used in programming
12
star
11

datagit

Random notes about data science workflows with Python, git, and the Jupyter notebook
7
star
12

rossant.github.io

HTML
6
star
13

phd-thesis-template

LaTeX template for a thesis
TeX
6
star
14

qtools

Some Python tools for Qt
Python
5
star
15

pipo

CLI helper for setuptools
Python
4
star
16

website

JavaScript
2
star
17

spiky

THIS REPOSITORY IS OUTDATED, the new one is:
Python
2
star
18

mdconvert

Convert Markdown documents in HTML, LaTeX and PDF
Python
2
star
19

collatepdf

A simple Python script to collate multiple PDFs into a single PDF.
Python
2
star
20

eye

Python
1
star
21

kwiklib2

1
star
22

odt-linux-mag

GitHub repository superseding the gist https://gist.github.com/rossant/99a2316465c84192b630
Python
1
star
23

yam

Command-line remote controller for Yamaha AV network systems
Python
1
star
24

rust-emscripten-passes

LLVM passes for compiling Rust code with Emscripten
C++
1
star
25

easy_profiler

Easy-to-use profiler in Python
Python
1
star
26

synthesizer

Python
1
star
27

brian-modelfitting-tutorial

Python
1
star