Book Image

Learning IPython for Interactive Computing and Data Visualization

By : Cyrille Rossant
Book Image

Learning IPython for Interactive Computing and Data Visualization

By: Cyrille Rossant

Overview of this book

<p>You already use Python as a scripting language, but did you know it is also increasingly used for scientific computing and data analysis? Interactive programming is essential in such exploratory tasks and IPython is the perfect tool for that. Once you’ve learnt it, you won’t be able to live without it.<br /><br />"Learning IPython for Interactive Computing and Data Visualization" is a practical, hands-on, example-driven tutorial to considerably improve your productivity during interactive Python sessions, and shows you how to effectively use IPython for interactive computing and data analysis.<br /><br />This book covers all aspects of IPython, from the highly powerful interactive Python console to the numerical and visualization features that are commonly associated with IPython.</p> <p>You will learn how IPython lets you perform efficient vectorized computations, through examples covering numerical simulations with NumPy, data analysis with Pandas, and visualization with Matplotlib. You will also discover how IPython can be conveniently used to optimize your code using parallel computing and dynamic compilation in C with Cython.</p> <p>"Learning IPython for Interactive Computing and Data Visualization" will allow you to optimize your productivity in interactive Python sessions.</p>
Table of Contents (13 chapters)

Preface

You are a programmer using Python as a scripting language, maybe for software development. Learning IPython will let you use Python interactively in a highly efficient way, for example, when exploring algorithms or analyzing data. In addition, it is the best way to be introduced to the most advanced capabilities of the platform, namely numerical computing, interactive visualization, and parallel programming.

What this book covers

Chapter 1, Getting Started with IPython, is a short, hands-on introduction to the key features of IPython. It will give you a broad overview of what IPython offers. All features introduced in this chapter will be covered in the subsequent chapters.

Chapter 2, Interactive Work with IPython, will show you how to use Python interactively from the IPython command-line interface, and how the numerous magic commands will help you considerably improve your productivity. This chapter will also introduce you to the IPython notebook, a modern tool for reproducible and collaborative interactive programming.

Chapter 3, Numerical Computing with IPython, contains an introduction to the numerical computing features of Numpy and Pandas, which can be conveniently used from IPython. These tools are essential as soon as you need to analyze large amounts of data, or more generally when you need to perform efficient numerical computations.

Chapter 4, Interactive Plotting and Graphical Interfaces, covers the graphical capabilities of Matplotlib, and shows how they integrate smoothly in IPython. Matplotlib is a very powerful graphical library, which allows you to either generate high-quality figures or to visualize data interactively.

Chapter 5, High-Performance and Parallel Computing, is an advanced chapter detailing various ways by which you can accelerate your code, such as parallel computing and dynamic C compilation. The former method consists in distributing tasks across cores or computers, which is particularly easy to do with IPython. The latter method lets you write code in a superset of Python (using the Cython library), which is then dynamically compiled in C for dramatic speed improvements.

Chapter 6, Customizing IPython, shows you how you can customize IPython, create new magic commands, and use custom representations in the IPython notebook.

What you need for this book

This book assumes familiarity with the Python language. In addition, you will need to have a Python installation on your computer (Windows, OS X, or Linux). You will also need to install IPython as well as a few other external libraries. The installation procedures are detailed in Chapter 1, Getting Started with IPython.

Who this book is for

This book is intended for Python programmers who want to learn IPython for the advanced console, the notebook, and the interactive computing facilities offered by the platform. Students, hackers, scientists, and hobbyists who are interested in interactive computing, data analysis, and visualization will also be interested in this book, but will need to learn the basics of Python first. Fortunately, Python is a very accessible language, and a lot of books, courses, and tutorials are available.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "For instance, the standard Unix commands pwd, ls, cd are available in IPython."

A block of code is set as follows:

print("Running script.")
x = 12
print("'x' is now equal to {0:d}.".format(x))

Any command-line input or output is written as follows:

In [1]: run script.py
Running script.
'x' is now equal to 12.
In [2]: x
Out[2]: 12

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Click on the New Notebook button at the top right of the page".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title through the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you. In addition, all examples can be downloaded from the author's website: http://ipython.rossant.net.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.