NumPy, which stands for “Numeric Python,” is an open-source Python scripting library used to provide array objects 50x faster than conventional lists in Python. It is considered to be the fundamental package for all scientific computing in Python. It offers various powerful data structures that support multi-dimensional and single-dimensional array objects. NumPy provides a set of functions that can perform numeric computations, manipulate arrays, and manage data in vectors and matrices with high speed.

NumPy was built by Travis Oliphant in 2005. Today, it is popularly used for data science, engineering, and mathematical programming. It has become a global standard in Python for performing mathematical and statistical operations. NumPy works perfectly with numerical data, multi-dimensional arrays, and matrix multiplication.

It can be used with core data science tools like Pandas, SciPy, Matplotlib, scikit-learn, and TensorFlow for array computing.

## How NumPy is used

NumPy is Python’s core package for scientific computing and numerical analysis.

It can be utilized for a wide range of mathematical functions on arrays and supplies an enormous library of high-level array-based mathematical operations. It enhances Python’s capabilities by providing strong data structures that guarantee effective calculations with arrays and matrices.

NumPy is also popular in quantitative fields like data science and analysis, deep learning, and machine learning. It provides useful statistical operations such as calculating means, medians, variances, and standard deviations that are important in data analysis.

It can also be used to manipulate enormous arrays of data required for training machine learning models and to carry out complicated mathematical operations like matrix multiplication.

## Installing NumPy

NumPy runs on Linux, macOS, and Windows and is easy to install by executing a few instructions in your terminal window. First, make sure Python is already installed on your device.

On macOS and Linux, NumPy may be installed via conda, Pip, or package management.

## Using Conda

Conda is an open-source package management system. You can find documentation on how to install Conda here. Once installed, you can install NumPy with Conda using the following steps:

- Instead of installing in the base environment first, use an environment to install NumPy.

```
$ conda create -n my-env
$ conda activate my-env
```

- You can install using conda-forge

```
$ conda config --env --add channels conda-forge
```

- Using the install command itself

```
$ conda install numpy
```

## Using Pip,

Pip is the most convenient way to install NumPy. It is a package manager that allows you to install and manage Python software packages. You can find documentation on how to install Pip here.

- Once that is successfully installed, you can run the following command:

```
$ pip install numpy
```

- Verify the install by using this command

```
import numpy
```

## Examples

### Calculate the mean of an array of numbers

This operation aims to determine the sum of the numbers divided by the number of elements in the array [5, 10, 13, 4, 2].

```
import numpy as np
a = np.array[5,10,13,4,2]
print(a)
print(np.mean(a))
Output: 6.8
```

### Calculate the Variance of an array of numbers

This operation aims to determine the average of the square deviations of the array [4, 6, 1, 9, 7]

```
import numpy as np
a = np.array([4,6,1,9,7])
print(a)
print(np.var(a))
Output: 8.24
```