Numpy
introducrion to numpy || by ProgGeek
Numpy stand for "Numerical Python". Numpy contain powerful n-dimesions array.it is also usefull in linear algebra,random number capabiity etc.
installation of numpy :
to install python numpy
step1 : open command prompt(cmd)
step2 : write command "pip install numpy" and execute.
step3: once you installed open any ide and import numpy "import numpy"
Numpy array:
numpy array is powerful n-dimenssion array which are form in rows and colums.
import numpy:
>>> import numpy as npArray (1-d,2-d) :
>>> print(np.array([1,2,3]))
[1 2 3]
>>> print(np.array([[1,2,3],[1,2,3]]))
[[1 2 3]
[1 2 3]]
Ones and Zeros Array using numpy:
>>> ones = np.ones([3,3])
>>> print(ones)
[[1. 1. 1.]
[1. 1. 1.]
[1. 1. 1.]]
>>> zeros = np.zeros([11,20])
>>> print(zeros)
[[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]]
Comments
Post a Comment