O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning IPython for Interactive Computing and Data Visualization - Second Edition

Book Description

Get started with Python for data analysis and numerical computing in the Jupyter notebook

About This Book

  • Learn the basics of Python in the Jupyter Notebook

  • Analyze and visualize data with pandas, NumPy, matplotlib, and seaborn

  • Perform highly-efficient numerical computations with Numba, Cython, and ipyparallel

  • Who This Book Is For

    This book targets students, teachers, researchers, engineers, analysts, journalists, hobbyists, and all data enthusiasts who are interested in analyzing and visualizing real-world datasets. If you are new to programming and data analysis, this book is exactly for you. If you're already familiar with another language or analysis software, you will also appreciate this introduction to the Python data analysis platform. Finally, there are more technical topics for advanced readers. No prior experience is required; this book contains everything you need to know.

    What You Will Learn

  • Install Anaconda and code in Python in the Jupyter Notebook

  • Load and explore datasets interactively

  • Perform complex data manipulations effectively with pandas

  • Create engaging data visualizations with matplotlib and seaborn

  • Simulate mathematical models with NumPy

  • Visualize and process images interactively in the Jupyter Notebook with scikit-image

  • Accelerate your code with Numba, Cython, and IPython.parallel

  • Extend the Notebook interface with HTML, JavaScript, and D3

  • In Detail

    Python is a user-friendly and powerful programming language. IPython offers a convenient interface to the language and its analysis libraries, while the Jupyter Notebook is a rich environment well-adapted to data science and visualization. Together, these open source tools are widely used by beginners and experts around the world, and in a huge variety of fields and endeavors.

    This book is a beginner-friendly guide to the Python data analysis platform. After an introduction to the Python language, IPython, and the Jupyter Notebook, you will learn how to analyze and visualize data on real-world examples, how to create graphical user interfaces for image processing in the Notebook, and how to perform fast numerical computations for scientific simulations with NumPy, Numba, Cython, and ipyparallel. By the end of this book, you will be able to perform in-depth analyses of all sorts of data.

    Style and approach

    This is a hands-on beginner-friendly guide to analyze and visualize data on real-world examples with Python and the Jupyter Notebook.

    Downloading the example code for this book. 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 code file.

    Table of Contents

    1. Learning IPython for Interactive Computing and Data Visualization Second Edition
      1. Table of Contents
      2. Learning IPython for Interactive Computing and Data Visualization Second Edition
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Getting Started with IPython
        1. What are Python, IPython, and Jupyter?
          1. Jupyter and IPython
          2. What this book covers
          3. References
        2. Installing Python with Anaconda
          1. Downloading Anaconda
          2. Installing Anaconda
          3. Before you get started...
            1. Opening a terminal
            2. Finding your home directory
            3. Manipulating your system path
          4. Testing your installation
          5. Managing environments
          6. Common conda commands
          7. References
          8. Downloading the notebooks
        3. Introducing the Notebook
          1. Launching the IPython console
          2. Launching the Jupyter Notebook
          3. The Notebook dashboard
          4. The Notebook user interface
          5. Structure of a notebook cell
            1. Markdown cells
            2. Code cells
          6. The Notebook modal interface
            1. Keyboard shortcuts available in both modes
            2. Keyboard shortcuts available in the edit mode
            3. Keyboard shortcuts available in the command mode
          7. References
        4. A crash course on Python
          1. Hello world
          2. Variables
          3. String escaping
          4. Lists
          5. Loops
          6. Indentation
          7. Conditional branches
          8. Functions
          9. Positional and keyword arguments
          10. Passage by assignment
          11. Errors
          12. Object-oriented programming
          13. Functional programming
          14. Python 2 and 3
          15. Going beyond the basics
        5. Ten Jupyter/IPython essentials
          1. Using IPython as an extended shell
          2. Learning magic commands
          3. Mastering tab completion
          4. Writing interactive documents in the Notebook with Markdown
          5. Creating interactive widgets in the Notebook
          6. Running Python scripts from IPython
          7. Introspecting Python objects
          8. Debugging Python code
          9. Benchmarking Python code
          10. Profiling Python code
        6. Summary
      9. 2. Interactive Data Analysis with pandas
        1. Exploring a dataset in the Notebook
          1. Provenance of the data
          2. Downloading and loading a dataset
          3. Making plots with matplotlib
          4. Descriptive statistics with pandas and seaborn
        2. Manipulating data
          1. Selecting data
            1. Selecting columns
            2. Selecting rows
            3. Filtering with boolean indexing
          2. Computing with numbers
          3. Working with text
          4. Working with dates and times
          5. Handling missing data
        3. Complex operations
          1. Group-by
          2. Joins
        4. Summary
      10. 3. Numerical Computing with NumPy
        1. A primer to vector computing
          1. Multidimensional arrays
          2. The ndarray
          3. Vector operations on ndarrays
          4. How fast are vector computations in NumPy?
          5. How an ndarray is stored in memory
          6. Why operations on ndarrays are fast
        2. Creating and loading arrays
          1. Creating arrays
          2. Loading arrays from files
        3. Basic array manipulations
        4. Computing with NumPy arrays
          1. Selection and indexing
          2. Boolean operations on arrays
          3. Mathematical operations on arrays
          4. A density map with NumPy
          5. Other topics
        5. Summary
      11. 4. Interactive Plotting and Graphical Interfaces
        1. Choosing a plotting backend
          1. Inline plots
          2. Exported figures
          3. GUI toolkits
          4. Dynamic inline plots
          5. Web-based visualization
        2. matplotlib and seaborn essentials
          1. Common plots with matplotlib
          2. Customizing matplotlib figures
          3. Interacting with matplotlib figures in the Notebook
          4. High-level plotting with seaborn
        3. Image processing
        4. Further plotting and visualization libraries
          1. High-level plotting
            1. Bokeh
            2. Vincent and Vega
            3. Plotly
          2. Maps and geometry
            1. The matplotlib Basemap toolkit
            2. GeoPandas
            3. Leaflet wrappers: folium and mplleaflet
          3. 3D visualization
            1. Mayavi
            2. VisPy
        5. Summary
      12. 5. High-Performance and Parallel Computing
        1. Accelerating Python code with Numba
          1. Random walk
          2. Universal functions
        2. Writing C in Python with Cython
          1. Installing Cython and a C compiler for Python
          2. Implementing the Eratosthenes Sieve in Python and Cython
        3. Distributing tasks on several cores with IPython.parallel
          1. Direct interface
          2. Load-balanced interface
        4. Further high-performance computing techniques
          1. MPI
          2. Distributed computing
          3. C/C++ with Python
          4. GPU computing
          5. PyPy
          6. Julia
        5. Summary
      13. 6. Customizing IPython
        1. Creating a custom magic command in an IPython extension
        2. Writing a new Jupyter kernel
        3. Displaying rich HTML elements in the Notebook
          1. Displaying SVG in the Notebook
          2. JavaScript and D3 in the Notebook
        4. Customizing the Notebook interface with JavaScript
        5. Summary
      14. Index