Introduction to Numpy Library in Python
Introduction to Numpy Library in Python
NUMPY - Introduction |
Introduction
Installation of Numpy
#installation of NUMPY using PIP
pip install numpy
(OR)
#installation of NUMPY using CONDA
conda install numpy
#check for version of NUMPY
numpy --version
Comparison of Lists and Numpy
for (i = 0; i < rows; i++): {
for (j = 0; j < columns; j++): {
c[i][j] = a[i][j]*b[i][j];
}
}
c = a * b
How to import Numpy in your program?
import numpy
import numpy as np
Examples
Sample program using Numpy
import numpy as np
maths = np.array([90, 67, 98, 100, 37])
science = np.array([100, 87, 47, 89, 45])
print("Maths marks : \n", maths)
print("Science marks : \n", science)
student_marks = np.array([maths, science], dtype = int)
print("Student marks of Maths and Science : \n", student_marks)
Output
Maths marks :
[ 90 67 98 100 37]
Science marks :
[100 87 47 89 45]
Student marks of Maths and Science :
[[ 90 67 98 100 37]
[100 87 47 89 45]]
Conclusion
Learn, Code, Practice!!!
Personal Writings for Readers!!!
Story behind single family described in Pandemic Family Book.
Read more on...
Paperback - https://amzn.to/34NS6Sk
Amazon Kindle - https://amzn.to/3aKtIng
Kobo Writing - https://bit.ly/3iQysNy
Comments
Post a Comment