Introduction to NumPy¶
NumPy (numerical Python) is a library that consists of multidimensional array objects and a set of routines for processing them. NumPy allows you to perform mathematical and logical operations on arrays. This tutorial walks you through the fundamentals of NumPy, including its design and architectue. It also covers array features, indexing types, and other topics.
What is NumPy?¶
- NumPy is a Python module that allows you to interact with arrays.
- It also provides functions for working with matrices, fourier transforms, and linear algebra.
- Travis Oliphant invented NumPy in 2005. It is an open source project that you are free to use.
- Numeric Python is referred to as NumPy.
Why Use NumPy?¶
- We have lists in Python that act as arrays, however they are slow to process.
- NumPy aims to provide an array object that is up to 50 times faster than traditional Python lists.
- The array object in NumPy is called ndarray.
- In data science, when speed and resources are important, arrays are frequently used.
Note: Data Science: is a branch of computer science where we study how to store, use and analyze data for deriving information from it.
Which Language is NumPy written in?¶
NumPy is a Python library that is partially written in Python, but the majority of the elements that require fast computation are written in C or C++.
!pip install numpy
NumPy is usually imported under the np alias.
import numpy as np
import platform import numpy as np print('Python version: ' + platform.python_version()) print('Numpy version: ' + np.__version__)
Python version: 3.6.8 Numpy version: 1.18.5