This repository contains the recipes of the IPython Cookbook, the definitive guide to high-performance scientific computing and data science in Python, by Dr. Cyrille Rossant, Packt Publishing, 400 pages, 2014. The book will be released later this summer.
This is work in progress: stay tuned for the next updates!
- 2.7. Writing unit tests with nose (Python 2)
- 2.7. Writing unit tests with nose (Python 3)
- Full list of references.
- 4.1. Evaluating the time taken by a command in IPython
- 4.2. Evaluating the time taken by a command in IPython
- 4.3. Profiling your code line by line with line_profiler
- 4.4. Profiling the memory usage of your code with memory_profiler
- 4.5. Understanding the internals of NumPy to avoid unnecessary array copy
- 4.6. Using stride tricks with NumPy
- 4.7. Implementing an efficient rolling average algorithm with stride tricks
- 4.8. Making efficient selections in arrays with NumPy
- 4.9. Processing huge NumPy arrays with memory mapping
- 4.10. Manipulating large arrays with HDF5 and PyTables
- 4.11. Manipulating large heterogeneous tables with HDF5 and PyTables
- Full list of references.
The structure of the repo is the following:
notebooks/ all notebooks with the code of all examples
chapter01_tour/
chapter02_best_practices/
...
extra/ extra code example that didn't make it in the book
guests/ guest recipes
featured/ a selection of complete recipes with all text, figures and code
references/ a curated list of references about scientific Python programming
tools/ various building Python scripts
You need Python 3 (or 2) and a bunch of scientific modules for the code examples, mainly IPython 2.0+, NumPy, SciPy, Pandas, and matplotlib. Many recipes that require other modules come with the appropriate installation instructions.
We highly recommend that you use an all-in-one Python distribution like Anaconda. This distribution comes with an excellent package manager named conda. It lets you install easily many modules on most platforms (Windows, Linux, Mac OS X), in 64-bit (recommended if you have a 64-bit OS) or 32-bit.
The recipes are written for Python 3 first, but they also work with Python 2. Please favor Python 3 over Python 2 if you can.
You need git, a distributed versioning system, to download a local copy of this repository. Open a terminal and type:
git clone https://github.com/ipython-books/cookbook-code.git
This will copy the repository in a local folder named cookbook-code.
Launch the IPython notebook server with:
ipython notebook
In your browser, go to 127.0.0.1:8888. You can navigate in the repository and open the notebooks.
You are welcome to contribute to this repository. You can use the issue tracker to report any problem. You can also propose a pull request (PR) to fix an error, to add some information, or even propose a brand new recipe in the guests/ folder!