2. NumPy
NumPy is a Python package. It stands for 'Numerical
Python'. It is a library consisting of multidimensional
array objects and a collection of routines for
processing of array.
4. Why NumPy
NumPy uses much less memory to store data.
The NumPy arrays takes significantly less amount of memory as
compared to python lists.
It also provides a mechanism of specifying the data types of the
contents, which allows further optimisation of the code
5. How to install NumPy in windows
py -m pip install numpy
Open Command Prompt in windows
Than set user account
And run follow command ( When computer is connected to
internet )
11. Array attributes in NumPy
import numpy as np
A=np.array( [30,67,89] )
print(A.ndim)
Output:
1
ndim-: This array attribute returns the number of array dimensions.
12. Array attributes in NumPy
import numpy as np
A=np.array( [
[30,67,89],
[38,27,89]
])
print(A.size)
Output:
6
size-: This array attribute returns the total number of elements of array
13. Array attributes in NumPy
import numpy as np
A=np.array( [
[30,67,89],
[38,27,89]
])
print(A.shape)
Output:
(2,3)
shape-: This array attribute returns a tuple consisting of array dimensions. It can
also be used to resize the array.