You are previewing NumPy Cookbook.
O'Reilly logo
NumPy Cookbook

Book Description

If you're a Python developer with basic NumPy skills, the 70+ recipes in this brilliant cookbook will boost your skills in no time. Learn to raise productivity levels and code faster and cleaner with the open source mathematical library.

  • Do high performance calculations with clean and efficient NumPy code

  • Analyze large sets of data with statistical functions

  • Execute complex linear algebra and mathematical computations

  • In Detail

    Today's world of science and technology is all about speed and flexibility. When it comes to scientific computing, NumPy is on the top of the list. NumPy will give you both speed and high productivity.

    "NumPy Cookbook" will teach you all about NumPy, a leading scientific computing library. NumPy replaces a lot of the functionality of Matlab and Mathematica, but in contrast to those products, it is free and open source.

    "Numpy Cookbook" will teach you to write readable, efficient, and fast code that is as close to the language of Mathematics as much as possible with the cutting edge open source NumPy software library.

    You will learn about installing and using NumPy and related concepts. At the end of the book, we will explore related scientific computing projects.

    This book will give you a solid foundation in NumPy arrays and universal functions. You will also learn about plotting with Matplotlib and the related SciPy project through examples.

    "NumPy Cookbook" will help you to be productive with NumPy and write clean and fast code.

    Table of Contents

    1. NumPy Cookbook
      1. NumPy Cookbook
      2. Credits
      3. About the Author
      4. About the Reviewers
      5. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      6. 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. Errata
          3. Piracy
          4. Questions
      7. 1. Winding Along with IPython
        1. Introduction
        2. Installing IPython
          1. How to do it...
          2. How it works...
        3. Using IPython as a shell
          1. How to do it...
          2. How it works...
        4. Reading manual pages
          1. How to do it...
          2. How it works...
        5. Installing Matplotlib
          1. How to do it...
        6. Running a web notebook
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Exporting a web notebook
          1. How to do it...
        8. Importing a web notebook
          1. How to do it...
        9. Configuring a notebook server
          1. How to do it...
          2. How it works...
        10. Exploring the SymPy profile
          1. Getting ready
          2. How to do it...
      8. 2. Advanced Indexing and Array Concepts
        1. Introduction
        2. Installing SciPy
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Installing PIL
          1. How to do it...
        4. Resizing images
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Creating views and copies
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Flipping Lena
          1. How to do it...
          2. See also
        7. Fancy indexing
          1. How to do it...
          2. How it works...
        8. Indexing with a list of locations
          1. How to do it...
        9. Indexing with booleans
          1. How to do it...
          2. How it works...
          3. See also
        10. Stride tricks for Sudoku
          1. How to do it...
          2. How it works...
        11. Broadcasting arrays
          1. How to do it...
      9. 3. Get to Grips with Commonly Used Functions
        1. Introduction
        2. Summing Fibonacci numbers
          1. How to do it...
          2. How it works...
          3. See also
        3. Finding prime factors
          1. How to do it...
          2. How it works...
        4. Finding palindromic numbers
          1. How to do it...
          2. How it works...
          3. There's more...
        5. The steady state vector determination
          1. How to do it...
          2. How it works...
          3. See also
        6. Discovering a power law
          1. How to do it...
          2. How it works...
          3. See also
        7. Trading periodically on dips
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        8. Simulating trading at random
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        9. Sieving integers with the Sieve of Erasthothenes
          1. How to do it...
      10. 4. Connecting NumPy with the Rest of the World
        1. Introduction
        2. Using the buffer protocol
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Using the array interface
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Exchanging data with MATLAB and Octave
          1. Getting ready
          2. How to do it...
          3. See also
        5. Installing RPy2
          1. How to do it...
        6. Interfacing with R
          1. Getting ready
          2. How to do it...
          3. See also
        7. Installing JPype
          1. How to do it...
        8. Sending a NumPy array to JPype
          1. How to do it...
          2. How it works...
          3. See also
        9. Installing Google App Engine
          1. How to do it...
        10. Deploying NumPy code in the Google cloud
          1. How to do it...
          2. How it works...
        11. Running NumPy code in a Python Anywhere web console
          1. How to do it...
          2. How it works...
        12. Setting up PiCloud
          1. How to do it...
          2. How it works...
      11. 5. Audio and Image Processing
        1. Introduction
        2. Loading images into memory map
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Combining images
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Blurring images
          1. How to do it...
          2. How it works...
        5. Repeating audio fragments
          1. How to do it...
          2. How it works...
        6. Generating sounds
          1. How to do it...
          2. How it works...
        7. Designing an audio filter
          1. How to do it...
          2. How it works...
        8. Edge detection with the Sobel filter
          1. How to do it...
          2. How it works...
      12. 6. Special Arrays and Universal Functions
        1. Introduction
        2. Creating a universal function
          1. How to do it...
          2. How it works...
        3. Finding Pythagorean triples
          1. How to do it...
          2. How it works...
        4. Performing string operations with chararray
          1. How to do it...
          2. How it works...
        5. Creating a masked array
          1. How to do it...
          2. How it works...
        6. Ignoring negative and extreme values
          1. How to do it...
          2. How it works...
        7. Creating a scores table with recarray
          1. How to do it...
          2. How it works...
      13. 7. Profiling and Debugging
        1. Introduction
        2. Profiling with timeit
          1. How to do it...
          2. How it works...
        3. Profiling with IPython
          1. How to do it...
          2. How it works...
        4. Installing line_profiler
          1. Getting ready
          2. How to do it...
          3. See also
        5. Profiling code with line_profiler
          1. How to do it...
          2. How it works...
        6. Profiling code with the cProfile extension
          1. How to do it...
        7. Debugging with IPython
          1. How to do it...
          2. How to do it...
        8. Debugging with pudb
          1. How to do it...
      14. 8. Quality Assurance
        1. Introduction
        2. Installing Pyflakes
          1. Getting ready
          2. How to do it...
        3. Performing static analysis with Pyflakes
          1. How to do it...
          2. How it works...
        4. Analyzing code with Pylint
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. See also
          3. Performing static analysis with Pychecker
            1. How to do it...
          4. Testing code with docstrings
            1. How to do it...
            2. How it works...
          5. Writing unit tests
            1. How to do it...
            2. How it works...
          6. Testing code with mocks
            1. How to do it...
            2. How it works...
          7. Testing the BDD way
            1. How to do it…
            2. How it works...
      15. 9. Speed Up Code with Cython
        1. Introduction
        2. Installing Cython
          1. How to do it...
        3. Building a Hello World program
          1. How to do it...
          2. How it works...
        4. Using Cython with NumPy
          1. How to do it...
          2. How it works...
        5. Calling C functions
          1. How to do it...
          2. How it works...
        6. Profiling Cython code
          1. How to do it...
          2. How it works...
        7. Approximating factorials with Cython
          1. How to do it...
          2. How it works...
      16. 10. Fun with Scikits
        1. Introduction
        2. Installing scikits-learn
          1. Getting ready
          2. How to do it...
        3. Loading an example dataset
          1. How to do it...
        4. Clustering Dow Jones stocks with scikits-learn
          1. How to do it...
          2. How it works...
        5. Installing scikits-statsmodels
          1. How to do it...
        6. Performing a normality test with scikits-statsmodels
          1. How to do it...
          2. How it works...
        7. Installing scikits-image
          1. How to do it...
        8. Detecting corners
          1. Getting ready
          2. How to do it...
          3. How it works...
        9. Detecting edges
          1. How to do it...
        10. Installing Pandas
          1. How to do it...
        11. Estimating stock returns correlation with Pandas
          1. How to do it...
          2. How it works...
        12. Loading data as pandas objects from statsmodels
          1. Getting ready
          2. How to do it...
          3. How it works...
        13. Resampling time series data
          1. How to do it...
          2. How it works...