Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Learning NumPy Array
Learning NumPy Array

Learning NumPy Array: Supercharge your scientific Python computations by understanding how to use the NumPy library effectively

eBook
€8.99 €18.99
Paperback
€22.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. €18.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Learning NumPy Array

Chapter 1. Getting Started with NumPy

Let's get started. We will install NumPy and related software on different operating sytems and have a look at some simple code that uses NumPy. As mentioned in the Preface, SciPy is closely related to NumPy, so you will see the name SciPy appearing throughout the chapter. At the end of this chapter, you will find pointers on how to find additional information online if you get stuck or are uncertain about the best way to solve problems.

In this chapter, we shall learn the following skills:

  • Installing Python, SciPy, Matplotlib, IPython, and NumPy on Windows, Linux, and Macintosh

  • Writing simple NumPy code

  • Adding arrays

  • Making use of online resources and help

Python


NumPy is based on Python, so it is required to have Python installed. On some operating systems, Python is already installed. You, however, need to check whether the Python version is compatible with the NumPy version you want to install. There are many implementations of Python, including commercial implementations and distributions. In this book, we will focus on the standard CPython implementation, which is guaranteed to be compatible with NumPy.

NumPy has binary installers for Windows, various Linux distributions, and Mac OS X. There is also a source distribution, if you prefer that. You need to have Python 2.4.x or above installed on your system. Python 2.7.6 is currently the best Python version to have because most scientific Python libraries support it.

Installing NumPy, Matplotlib, SciPy, and IPython on Windows


Installing NumPy on Windows is a necessary but, fortunately, straightforward task that we will cover in detail. You only need to download an installer, and a wizard will guide you through the installation steps. It is recommended that Matplotlib, SciPy, and IPython be installed. However, this is not required to enjoy this book. The actions we will take are as follows:

  1. Download a NumPy installer for Windows from the SourceForge website at http://sourceforge.net/projects/numpy/files/.

  2. Choose the appropriate version. In this example, we chose numpy-1.8.0-win32-superpack-python2.7.exe.

  3. Open the EXE installer by double-clicking on it.

  4. Now, we can see a description of NumPy and its features, as shown in the previous screenshot. Click on the Next button.

  5. If you have Python installed, it should automatically be detected. If it is not detected, maybe your path settings are wrong. At the end of this chapter, resources are listed in case you have problems installing NumPy.

  6. In this example, Python 2.7 was found. Click on the Next button if Python is found, otherwise, click on the Cancel button and install Python (NumPy cannot be installed without Python). Click on the Next button. This is the point of no return. Well, kind of, but it is best to make sure that you are installing to the proper directory and so on and so forth. Now the real installation starts. This may take a while.

  7. Install SciPy and Matplotlib with the Enthought distribution at http://www.enthought.com/products/epd.php.

    Note

    The situation around installers is rapidly evolving. Other alternatives exist in various stage of maturity (see http://www.scipy.org/install.html). It might be necessary to put the msvcp71.dll file in your C:\Windows\system32 directory. You can get it at http://www.dll-files.com/dllindex/dll-files.shtml?msvcp71. A Windows IPython installer is available on the IPython website (see http://ipython.scipy.org/Wiki/IpythonOnWindows).

Installing NumPy, Matplotlib, SciPy, and IPython on Linux


Installing NumPy and related recommended software on Linux depends on the distribution you have. We will discuss how you would install NumPy from the command line although you could probably use graphical installers; it depends on your distribution (distro). The commands to install Matplotlib, SciPy, and IPython are the same—only the package names are different. Installing Matplotlib, SciPy, and IPython is recommended, but optional.

Most Linux distributions have NumPy packages. We will go through the necessary steps for some of the popular Linux distros:

  • Run the following instructions from the command line for installing NumPy on Red Hat:

    yum install python-numpy
    
  • To install NumPy on Mandriva, run the following command-line instruction:

    urpmi python-numpy
    
  • To install NumPy on Gentoo, run the following command-line instruction:

    sudo emerge numpy
    
  • To install NumPy on Debian or Ubuntu, we need to type the following:

    sudo apt-get install python-numpy
    

The following table gives an overview of the Linux distributions and corresponding package names for NumPy, SciPy, Matplotlib, and IPython:

Linux distribution

NumPy

SciPy

Matplotlib

IPython

Arch Linux

python-numpy

python-scipy

python-matplotlib

ipython

Debian

python-numpy

python-scipy

python-matplotlib

ipython

Fedora

numpy

python-scipy

python-matplotlib

ipython

Gentoo

dev-python/numpy

scipy

matplotlib

ipython

OpenSUSE

python-numpy, python-numpy-devel

python-scipy

python-matplotlib

ipython

Slackware

numpy

scipy

matplotlib

ipython

Installing NumPy, Matplotlib, and SciPy on Mac OS X


You can install NumPy, Matplotlib, and SciPy on the Mac with a graphical installer or from the command line with a port manager, such as MacPorts or Fink, depending on your preference.

Note

We can get a NumPy installer from the SourceForge website at http://sourceforge.net/projects/numpy/files/. Similar files exist for Matplotlib and SciPy. Just change numpy in the previous URL to scipy or matplotlib. IPython didn't have a GUI installer at the time of writing. Download the appropriate DMG file as shown in the following screenshot; usually the latest one is the best. Another alternative is the SciPy Superpack (https://github.com/fonnesbeck/ScipySuperpack). Whichever option you choose, it is important to make sure that updates which impact the system Python library don't negatively influence the already installed software by not building against the Python library provided by Apple.

We will install NumPy with a GUI installer using the following steps:

  1. Open the DMG file as shown in the following screenshot (in this example, numpy-1.8.0-py2.7-python.org-macosx10.6.dmg):

  2. Double-click on the icon of the opened box, that is, the one having a subscript that ends with .mpkg. We will be presented with the welcome screen of the installer.

  3. Click on the Continue button to go to the Read Me screen, where we will be presented with a short description of NumPy, as shown in the following screenshot:

  4. Click on the Continue button to go to the License screen.

  5. Read the license, click on the Continue button, and then on the Accept button, when prompted to accept the license. Continue through the next screens and click on the Finish button at the end.

Alternatively, we can install NumPy, SciPy, Matplotlib, and IPython through the MacPorts route or with Fink. The following installation steps install all these packages. We only need NumPy for the tutorials in this book, so please omit the packages you are not interested in.

  • To install with MacPorts, type the following command:

    sudo port install py-numpy py-scipy py-matplotlib py-ipython
    
  • Fink also has packages for NumPy: scipy-core-py24, scipy-core-py25, and scipy-core-py26. The SciPy packages are: scipy-py24, scipy-py25, and scipy-py26. We can install NumPy and the other recommended packages that we will be using in this book for Python 2.6 with the following command:

    fink install scipy-core-py26 scipy-py26 matplotlib-py26
    

Building from source


As a last resort or if we want to have the latest code, we can build from source. In practice it shouldn't be that hard although, depending on your operating system, you might run into problems. As operating systems and related software are rapidly evolving, the best you can do is search online or ask for help. In this chapter, we give pointers on good places to look for help.

The steps to install NumPy from source are straightforward and given here. We can retrieve the source code for NumPy with .git as follows:

git clone git://github.com/numpy/numpy.git numpy

Install on /usr/local with the following command:

python setup.py build
sudo python setup.py install --prefix=/usr/local

To build, we need a C compiler such as GCC and the Python header files in the python-dev or python-devel package.

NumPy arrays


After going through the installation of NumPy, it's time to have a look at NumPy arrays. NumPy arrays are more efficient than Python lists when it comes to numerical operations. NumPy arrays are in fact specialized objects with extensive optimizations. NumPy code requires less explicit loops than the equivalent Python code. This is based on vectorization.

If we go back to high school mathematics, then we should remember the concepts of scalars and vectors. The number 2 for instance is a scalar. When we add 2 and 2, we are performing scalar addition. We can form a vector out of a group of scalars. In Python programming terms, we will then have a one-dimensional array. This concept can of course be extended to higher dimensions. Performing an operation on two arrays such as addition can be reduced to a group of scalar operations. In straight Python, we will do that with loops going through each element in the first array and adding it to the corresponding element in the second array. However, this is more verbose than the way it is done in mathematics. In mathematics, we treat the addition of two vectors as a single operation. That's the way NumPy arrays do it too and there are certain optimizations using low-level C routines, which make these basic operations more efficient. We will cover NumPy arrays in more detail in the next chapter.

Adding arrays

Imagine that we want to add two vectors called a and b. A vector is used here in the mathematical sense, which means a one-dimensional array. We will learn in Chapter 4, Simple Predictive Analytics with NumPy, about specialized NumPy arrays that represent matrices. The vector a holds the squares of integers 0 to n, for instance. If n is equal to 3, then a contains 0, 1, or 4. The vector b holds the cubes of integers 0 to n, so if n is equal to 3, then the vector b is equal to 0, 1, or 8. How would you do that using plain Python? After we come up with a solution, we will compare it with the NumPy equivalent.

The following function solves the vector addition problem using pure Python without NumPy:

def pythonsum(n):
   a = range(n)
   b = range(n)
   c = []

   for i in range(len(a)):
       a[i] = i ** 2
       b[i] = i ** 3
       c.append(a[i] + b[i])

   return c

The following is a function that achieves the same with NumPy:

def numpysum(n):
  a = numpy.arange(n) ** 2
  b = numpy.arange(n) ** 3
  c = a + b
  return c

Notice that numpysum() does not need a for loop. Also, we used the arange function from NumPy, which creates a NumPy array for us with integers 0 to n. The arange function was imported; that is why it is prefixed with numpy.

Now comes the fun part. Remember that it is mentioned in the Preface that NumPy is faster when it comes to array operations. How much faster is Numpy, though? The following program will show us by measuring the elapsed time in microseconds, for the numpysum and pythonsum functions. It also prints the last two elements of the vector sum. Let's check that we get the same answers when using Python and NumPy:

#!/usr/bin/env/python

import sys
from datetime import datetime
import numpy as np

"""
 This program demonstrates vector addition the Python way.
 Run from the command line as follows
     
  python vectorsum.py n
 
 where n is an integer that specifies the size of the vectors.

 The first vector to be added contains the squares of 0 up to n.
 The second vector contains the cubes of 0 up to n.
 The program prints the last 2 elements of the sum and the elapsed time.
"""

def numpysum(n):
   a = np.arange(n) ** 2
   b = np.arange(n) ** 3
   c = a + b

   return c

def pythonsum(n):
   a = range(n)
   b = range(n)
   c = []

   for i in range(len(a)):
       a[i] = i ** 2
       b[i] = i ** 3
       c.append(a[i] + b[i])

   return c
   
size = int(sys.argv[1])

start = datetime.now()
c = pythonsum(size)
delta = datetime.now() - start
print "The last 2 elements of the sum", c[-2:]
print "PythonSum elapsed time in microseconds", delta.microseconds

start = datetime.now()
c = numpysum(size)
delta = datetime.now() - start
print "The last 2 elements of the sum", c[-2:]
print "NumPySum elapsed time in microseconds", delta.microseconds

The output of the program for the 1000, 2000, and 3000 vector elements is as follows:

$ python vectorsum.py 1000
The last 2 elements of the sum [995007996, 998001000]
PythonSum elapsed time in microseconds 707
The last 2 elements of the sum [995007996 998001000]
NumPySum elapsed time in microseconds 171
$ python vectorsum.py 2000
The last 2 elements of the sum [7980015996, 7992002000]
PythonSum elapsed time in microseconds 1420
The last 2 elements of the sum [7980015996 7992002000]
NumPySum elapsed time in microseconds 168
$ python vectorsum.py 4000
The last 2 elements of the sum [63920031996, 63968004000]
PythonSum elapsed time in microseconds 2829
The last 2 elements of the sum [63920031996 63968004000]
NumPySum elapsed time in microseconds 274

Tip

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.

Clearly, NumPy is much faster than the equivalent normal Python code. One thing is certain: we get the same results whether we are using NumPy or not. However, the result that is printed differs in representation. Notice that the result from the numpysum function does not have any commas. How come? Obviously we are not dealing with a Python list, but with a NumPy array. It was mentioned in the Preface that NumPy arrays are specialized data structures for numerical data. We will learn more about NumPy arrays in Chapter 2, NumPy Basics.

Online resources and help


The main documentation website for NumPy and SciPy is at http://docs.scipy.org/doc/. On this web page, we can browse the NumPy reference at http://docs.scipy.org/doc/numpy/reference/ and the user guide, as well as several tutorials.

NumPy has a wiki with lots of documentation at http://docs.scipy.org/numpy/Front%20Page/.

The NumPy and SciPy forum can be found at http://ask.scipy.org/en.

The popular Stack Overflow software development forum has hundreds of questions tagged as numpy. To view them, go to http://stackoverflow.com/questions/tagged/numpy.

If you are really stuck with a problem or you want to be kept informed of NumPy's development, you can subscribe to the NumPy discussion mailing list. The e-mail address is . The number of e-mails per day is not too high, and there is almost no spam to speak of. Most importantly, developers actively involved with NumPy also answer questions asked on the discussion group. The complete list can be found at http://www.scipy.org/Mailing_Lists.

For IRC users, there is an IRC channel on irc://irc.freenode.net. The channel is called #scipy, but you can also ask NumPy questions since SciPy users also have knowledge of NumPy, as SciPy is based on NumPy. There are at least 50 members on the SciPy channel at all times.

Summary


In this chapter, we installed NumPy and other recommended software that we will be using in some tutorials. We got a vector addition program working and convinced ourselves that NumPy has superior performance. In addition, we explored the available NumPy documentation and online resources.

In the next chapter, we will take a look under the hood and explore some fundamental concepts, including arrays and data types.

Left arrow icon Right arrow icon

What you will learn

  • Install NumPy and discover its arrays and features
  • Perform data analysis and complex array operations with NumPy
  • Analyze time series and perform signal processing
  • Understand NumPy modules and explore the scientific Python ecosystem
  • Improve the performance of calculations with clean and efficient NumPy code
  • Analyze large data sets using statistical functions and execute complex linear algebra and mathematical computations

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 13, 2014
Length: 164 pages
Edition :
Language : English
ISBN-13 : 9781783983902
Category :
Languages :
Concepts :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. €18.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Jun 13, 2014
Length: 164 pages
Edition :
Language : English
ISBN-13 : 9781783983902
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 98.97
NumPy Beginner's Guide
€37.99
Learning NumPy Array
€22.99
NumPy Cookbook
€37.99
Total 98.97 Stars icon
Banner background image

Table of Contents

7 Chapters
Getting Started with NumPy Chevron down icon Chevron up icon
NumPy Basics Chevron down icon Chevron up icon
Basic Data Analysis with NumPy Chevron down icon Chevron up icon
Simple Predictive Analytics with NumPy Chevron down icon Chevron up icon
Signal Processing Techniques Chevron down icon Chevron up icon
Profiling, Debugging, and Testing Chevron down icon Chevron up icon
The Scientific Python Ecosystem Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
(9 Ratings)
5 star 55.6%
4 star 22.2%
3 star 0%
2 star 11.1%
1 star 11.1%
Filter icon Filter
Top Reviews

Filter reviews by




Edward Grefenstette Aug 07, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The following review was produced after being sent a free copy of the book by Packt Publishing. I have endeavoured to be objective and state my view of the book, unaltered by this."Learning NumPy Array" by Ivan Idris is an excellent book which covers a range of use cases for the Python NumPy library across different aspects of scientific computing. It gives a short introduction to NumPy classes and core functions, discusses data analysis with NumPy data structures, and then using the pandas library (built on top of NumPy, amongst other libraries), provides a succinct overview of signal processing techniques with NumPy, followed by a short tutorial of profiling and debugging NumPy code with iPython, UnitTest, and Nose. The book ends with a helpful chapter on other tools scientific computing programmers may wish to consider alongside NumPy, most importantly cython and sklearn.While the book is entitled "Learning NumPy Array", it is not exactly aimed at a beginner audience. The reader is assumed to have a decent knowledge of linear algebra, statistics, and some cursory experience with similar statistics or matrix libraries/languages such as Matlab or R. While it does introduce NumPy basics, the reader should expect to have access to the NumPy documentation while reading the book to get the most out of it. Chapters 3 through 5 are quite dense, and readers without experience with the relevant areas (statistical analysis for chapters 3-4 and signal processing for chapter 5) will need to spend time and perhaps read third-party sources to get the most out of the material. All this is to say, this is a fairly technical book, but the examples are many, are well spelled-out, and coherently explained. Readers with a bit of experience in the domains it covers, or readers who are willing to put in the extra effort to read around the topics, will get a lot out of this book, and be able to implement solutions to similar problems quickly.In addition to the core material covered in chapters 3-5, I particularly enjoyed the fairly clear tutorials for profiling, debugging and testing in chapter six. Some of this material could easily have been excluded from the book in favour of expanding the explanations and giving some background in chapters 3-5, but I found the explanations to be well written and helpful, so the inclusion in this book is appreciated.Furthermore, the final chapter is a nice starting point for newcomers to the python scientific computing world, as it presents some helpful pointers (and use examples) to other resources available. Even as a researcher who has used these tools before once or twice, at least, this chapter was a good read and reminded me of how easily these libraries play with each other.Overall, this is a good read. It will take some small effort for most readers to get through the more technical sections of this book, but there is a lot to get out of reading it. While the same material can be found in several tutorials scattered around the web, it is good to see that someone took the effort to distil all the material into one volume, provide excellent example code, and enough explanation to feed intuitions as to how to best apply the knowledge presented in it.
Amazon Verified review Amazon
alan1955 Sep 17, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is an excellent book for learning NumPy. It is for someone who has experience with python and numerical coding. What I liked was chapter two where the book covers the basics of NumPy to get you quickly up and running. All in one chapter. So if you are already trying to do some basic things with NumPy, it will save you a lot of time. The rest of the book is filled with examples. The examples illustrate things you can do with NumPy, and are arranged topically. The topics cover basic data analysis, predictive analysis, smoothing, moving averages, and sifting. The other plus is that it introduces Scipy, the scientific python programming package. If you are not familiar with it, you will get to see what it can do in a few of the examples. It is also a short book. Being short it assumes you have a working knowledge of Python and some numerical experience. Too many computer books are so long, you can never get through them. Because of this you can quickly get up to speed. Also the code for examples can be downloaded, which is very helpful.
Amazon Verified review Amazon
Roberto Avilés Jul 30, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is a 7 chapters, +140 page hands-on introduction to the power of Python’s Library, NumPy.In Chapter 1, we learn to install Python, SciPy, Matplotlib, IPython and NumPy on Windows, Linux and Macintosh machines and start writing NumPy code.Chapter 2 reviews the basics on NumPy: Data Types, Array Types, Type Conversions, Creating, Indexing, Slicing and Manipulating array Shapes. Advantages of NumPy arrays: we know items in the array are of the same type (example, dtype!) plus, NumPy arrays can perform vectorized operations on the whole array: better than using lists; NumPy uses an optimized C API for those operations which make them especially fast. We learn how to transform a multidimensional array into a one dimensional array, how to stack, split, convert, copy and view them by playing with images, doing tricks with Sudoku and audio arrays.In Chapter 3 we are ready to learn Basic Data Analysis by working on a genuine (and quite completely) data set by looking for evidence of planetary heating.Chapter 4 is about Predictive Analysis and the use of the ‘pandas’ library. Pandas have plotting subroutines and in this chapter data of previous chapter is re-examined and extended to correlating weather and stocks!Now, in Chapter 5 we focus on ‘Signal Processing Techniques’ and analyze time series. The example data set will be sunspot data which we sift and plot to show the extremes of Sun activity. Tools as ‘moving averages’ and smoothing functions are introduced and we are ready to do a forecasting using an ARMA (autoregressive moving average) model. Then we learn how to design and use a filter and the “cointegration”, a better metric to define the relatedness of two time series.In Chapter 6 the book moves into Profiling, Debugging and Testing. NumPy adds the numpy.testing package (and its utility functions) to help NumPy code the unit testing. Later we met Nose, a Python framework that eases unit testing by organizing it.Chapter 7 relates to the Scientific Python Ecosystem. Scipy is built on NumPy and adds functionality as numerical integration, interpolation, optimization, statistics, clustering with scikit-learn, the detection of corners (all with examples), the use of Cython with NumPy and compares NumPy to Blaze (a collection of libraries being built towards the goal of generalizing NumPy ‘s data model and working on distributed data.)This book is a complete hands-on guide on the use of NumPy, through worked examples and ideas, a must have for those interested in Data Analysis, Forecasting and Signal Processing Techniques.
Amazon Verified review Amazon
Sujit Pal Jun 21, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Numpy is a fast matrix library that is at the core of scientific computing toolkits in Python - whether you are doing statistics, machine learning or signal processing (to name just a few possibilities), chances are you are using Numpy under the covers. Because Numpy is optimized for speed and because you are often dealing with large datasets, knowing the right function to call can mean the difference between run times of a few seconds or a few hours. This book can help you write cleaner and faster Numpy code.After a quick introduction to Numpy in Chapter 1, Chapter 2 takes the reader through a quick tour of Numpy functions, describing the major ones, including differently named functions which do the same thing, one updating in place and the other creating a copy. Chapter 3-5 on is all case studies, mostly about Time Series Analysis and Signal Processing, perhaps because they are good vehicles for demonstrating array handling techniques, but a nice side effect is that it gives the reader a quick introduction to these subjects as well. Chapter 6 describes Numpy's unit testing functionality, and also covers Python unit testing frameworks (unittest package as well as nose). It also describes how to profile and debug Python code from the IPython shell. Chapter 7 quickly covers various other players in the scientific Python ecosystem, and describes how to optimize Python code by rewriting them to Cython.I found the book immensely informative and relatively easy to read. It helps to actually work through the code in a Python shell as you are reading the book, in some cases the author condenses multiple steps into a single one, obviously expecting the reader to follow along, so being able to break the steps into smaller ones can help in understanding. Using the shell also gives you access to Python's help system, so you can read about new functions as you encounter them. One minor nit - it would have been more convenient if the data used for the analysis could have been packaged with the code for the book (for people reading the book offline) - but perhaps there are copyright restrictions on such distribution.DISCLAIMER: I didn't purchase this book, a PackT representative in my social network was offering free copies to review, and I asked for one because (a) I use Numpy and wanted to learn more and (b) as a Numpy user, I felt qualified to review the book objectively.
Amazon Verified review Amazon
Daniel R. Vallejo Sep 28, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
great
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.