Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Welcome!
NumPy a Python Library
1
2
print('Hello World: we will gonna talk about NumPy which is a library of Python!')
Enter to Rename, Shift+Enter to Preview
declaring new array and printing array elements 1
1
2
3
4
5
6
7
import numpy as np
print("Numpy library in Python")
# declaring new array
data = np.array([1,2,3,4,5,6,7])
# printing array elements
print(data)
Enter to Rename, Shift+Enter to Preview
declaring new array and printing array elements 2
1
2
3
4
5
6
7
import numpy as np
print("Numpy library in python")
# declaring new array
data = np.array(["Apple", "Oranges", "Grapes", "Banana"])
# printing array elements
print(data)
Enter to Rename, Shift+Enter to Preview
adding two arrays
1
2
3
4
5
# adding two arrays
data1 = np.array([7,4,3,2,1,8, 9])
data3 = data+data1
print(data3)
Enter to Rename, Shift+Enter to Preview
full is used for creating multi D array of your own choice elements
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# full is used for creating multi D array of your own choice elements
values = np.full([5,5],0)
print(values)
# all elemnts should be xero
values = np.zeros([9,9])
print(values)
# all elemnts should be ONES now
values = np.ones([3,3])
print(values)
print("\n\n")
dta = np.full([5,5],9)
print(dta)
Enter to Rename, Shift+Enter to Preview
Advanced usage
If you want a more complex example (external libraries, viewers...), use the Advanced Python template
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content