#### Data library `NumPy`

**NumPy** — an open source library for the Python programming language, which implements a large number of operations for working with vectors, matrices and arrays.

Mathematical algorithms implemented in interpreted languages (eg Python) are often much slower than those implemented in compiled languages (eg Fortran, C, Java). The

`NumPy `library provides implementations of computational algorithms (in the form of functions and operators) optimized for working with multidimensional arrays.

As a result, any algorithm that can be expressed as a sequence of operations on arrays (matrices) and implemented using

`NumPy` is fast enough.

`NumPy `(Numeric Python) is a core math library for working with data. This library underlies other libraries for working with machine learning or data analysis tasks (for example,

`Pandas ` (working with tabular data),

`SciPy ` (optimization methods and scientific calculations),

`Matplotlib `(plotting)).

#### Working with NumPy

In order to start working with the numpy library, you need to import it at the beginning of the program like any other library,

import numpy
or so (which is used more often)
import numpy as np

NumPy Vectors

**A vector** (or array) in NumPy is an ordered set of homogeneous data.

An element of a vector can be accessed by its index, just as it is done in lists. Each element of the vector has its own specific place, which is set during creation.

All vector elements have the same data type (`int`, `str`, `bool`, etc.).

Creating a Vector

To create a vector, you need to use the `numpy.array`

constructor (an iterable object).

Parentheses indicate any iterable object: tuple, list, range(), etc.

##### Example

import numpy as np
import numpy as np
print(np.array((1,2,3,4,5))) # vector from tuple
print(np.array([1,2,3,4,5])) # vector from list
print(np.array(range(5))) # vector from generator