Getting started with NumPy
The NumPy library is one of the main reasons why Python has gained so much traction in the data scientist community. It is a foundational library upon which a lot of the most popular libraries, such as pandas (https://pandas.pydata.org), Matplotlib (https://matplotlib.org), SciPy (https://www.scipy.org), and scikit-learn (http://scikit-learn.org) are built.
The key capabilities provided by NumPy are:
- A very powerful multidimensional NumPy array called ndarray with very high-performance mathematical operations (at least compared to regular Python lists and arrays)
- Universal functions also called
ufunc
for short, for providing very efficient and easy-to-use element by element operations on one or more ndarray - Powerful ndarray slicing and selection capabilities
- Broadcasting functions that make it possible to apply arithmetic operations on ndarray of different shapes provided that some rules are respected
Before we start exploring the NumPy APIs, there is one API...