NumPy Cookbook


NumPy Cookbook
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
$22.94
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
$44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Reviews
Support
Sample Chapters
  • 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

Book Details

Language : English
Paperback : 226 pages [ 235mm x 191mm ]
Release Date : October 2012
ISBN : 1849518920
ISBN 13 : 9781849518925
Author(s) : Ivan Idris
Topics and Technologies : All Books, Big Data and Business Intelligence, Data, Cookbooks, Open Source

Table of Contents

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

                      Ivan Idris

                      Ivan Idris was born in Bulgaria from Indonesian parents. He moved to the Netherlands and graduated from university with a degree in Experimental Physics.

                      His graduation thesis had a strong emphasis on Applied Computer Science. After graduating, he worked for several companies as a Java Developer, Data Warehouse Developer, and QA Analyst.

                      His main professional interests are Business Intelligence, big data, and cloud computing. He enjoys writing clean, testable code and interesting technical articles. He is the author of NumPy Beginner’s Guide, NumPy Cookbook, and Learning NumPy.

                      Code Downloads

                      Download the code and support files for this book.


                      Submit Errata

                      Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                      Errata

                      - 2 submitted: last submission 03 Sep 2013

                      Errata Type: Technical | Page no: 43

                      The line: "The itemsize field of ndarray gives us the number of bytes in an array."

                      Should Instead be:"The itemsize field of ndarray gives us the number of bytes in an array element."

                      Errata type : Technical | Page no 65

                      "freqs = 1.0/counts" 

                      should instead be this:

                      "freqs = 1.0/(counts+0.01)".

                      Some elements in the "counts" could be zero,thus "divide by zero" error can be avoided using this.

                      Sample chapters

                      You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                      Frequently bought together

                      NumPy Cookbook +    VMware vSphere 5.x Datacenter Design Cookbook =
                      50% Off
                      the second eBook
                      Price for both: $41.55

                      Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                      What you will learn from this book

                      • Learn advanced Indexing and linear algebra
                      • Know reshaping automatically
                      • Dive into Broadcasting and Histograms
                      • Profile NumPy code and visualize your profiling results
                      • Speed up your code with Cython
                      • Use the array interface to expose foreign memory to NumPy
                      • Use universal functions and interoperability features
                      • Learn about Matplotlib and Scipy which is often used in conjunction with Numpy

                      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.

                      Approach

                      Written in Cookbook style, the code examples will take your Numpy skills to the next level.

                      Who this book is for

                      This book will take Python developers with basic Numpy skills to the next level through some practical recipes.

                      Code Download and Errata
                      Packt Anytime, Anywhere
                      Register Books
                      Print Upgrades
                      eBook Downloads
                      Video Support
                      Contact Us
                      Awards Voting Nominations Previous Winners
                      Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                      Resources
                      Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software