Let's delve into the details.

__Installation of NumPy__

- The only prerequisite for NumPy is Python itself means you have to install Python on your PC.
- But If you don't have Python yet then you can use Anaconda distribution which includes Python, NumPy, and other commonly used packages for scientific computing and data science.
- NumPy can be installed with
`conda`

, with`pip`

`On windows`

- for this just open your Command prompt and use following anyone command according to your system.

__CONDA__

- If you use
`conda`

, you can install it with:

__PIP__

- If you use
`pip`

, you can install it with:

__NumPy- Ndarray Object__

- At the core of the NumPy package, is the ndarray object.
- This encapsulates n-dimensional arrays of homogeneous data types, with many operations being performed in compiled code for performance.
- There are several important differences between NumPy arrays and the standard Python sequences:

- NumPy arrays have a fixed size at creation, unlike Python lists (which can grow dynamically). Changing the size of an ndarray will create a new array and delete the original.
- The elements in a NumPy array are all required to be of the same data type, and thus will be the same size in memory. The exception: one can have arrays of (Python, including NumPy) objects, thereby allowing for arrays of different sized elements.
- NumPy arrays facilitate advanced mathematical and other types of operations on large numbers of data. Typically, such operations are executed more efficiently and with less code than is possible using Python’s built-in sequences.

- In other words, in order to efficiently use much (perhaps even most) of today’s scientific/mathematical Python-based software, just knowing how to use Python’s built-in sequence types is insufficient - one also needs to know how to use NumPy arrays.

**NumPy’s array class is called ndarray****.** It is also known by the alias array. Note that **numpy.array** is not the same as the Standard Python Library class array.array, which only handles one-dimensional arrays and offers less functionality.

__ARRAY CREATION__

__ARRAY CREATION__

There are several ways to create arrays.

- For example, you can create an array from a regular Python list or tuple using the array function.
- The type of the resulting array is deduced from the type of the elements in the sequences.

The type of the array can also be explicitly specified at creation time:

>>> aarray([2, 3, 4])

- The function zeros creates an array full of zeros, the function ones creates an array full of ones, and the function empty creates an array whose initial content is random and depends on the state of the memory. By default, the dtype of the created array is float64.

- To create sequences of numbers, NumPy provides a function analogous to range that returns arrays instead of lists.In this 10 is starting number , 30 is last number and rember this number will not be include in result and 5 is the difference between any two numbers.

- When arange is used with floating point arguments, it is generally not possible to predict the number of elements obtained, due to the finite floating point precision.
- For this reason, it is usually better to use the function linspace that receives as an argument the number of elements

__Creation of Identity Matrix __

**np.eye**function is used to create identity matrix.

__Creation of array of random numbers__

**np.random.rand**function is used to create array with random numbers

__Creation of array of same number [Constant]__

**np.full**function is used to create array of constant number.

## 0 Comments