Chapter 7. Peeking into Special Routines

As NumPy users, we sometimes find ourselves having special needs, for instance, financial calculations or signal processing. Fortunately, NumPy provides for most of our needs. This chapter describes some of the more specialized NumPy functions.

In this chapter, we will cover the following topics:

  • Sorting and searching
  • Special functions
  • Financial utilities
  • Window functions

Sorting

NumPy has several data sorting routines:

  • The sort() function returns a sorted array
  • The lexsort() function performs sorting with a list of keys
  • The argsort() function returns the indices that will sort an array
  • The ndarray class has a sort() method that performs in-place sorting
  • The msort() function sorts an array along the first axis
  • The sort_complex() function sorts complex numbers by their real part and then their imaginary part

From this list, the argsort() and sort() functions are available as methods on NumPy arrays as well.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset