-
Notifications
You must be signed in to change notification settings - Fork 67
/
npfunction.py
61 lines (49 loc) · 1.11 KB
/
npfunction.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import numpy as np
#arrange function
print(np.arrange(2,10))
print(np.arrange(2,10,2))
print(np.arrange(1,2,0.1))
#linspace function
print(np.linspace(1,2,10))
#reshape function
a=np.array([1,2,3,4,5,6,7,8,9])
print(a.reshape(3,3))
#dot function
a=np.array([1,2,3])
b=np.array([4,5,6])
print(np.dot(a,b))
vec_a=2+3j
vec_b=4+7j
print(np.dot(vec_a,vec_b))
#argmin function
a=np.array([1,2,3,4,5,6,7,8,9])
print(np.argmin(a))
#argmax function
print(np.argmax(a))
#mean function
print(np.mean(a))
#median function
print(np.median(a))
#standard deviation function
print(np.std(a))
#variance function
print(np.var(a))
#concatenate function
a=np.array([1,2,3])
b=np.array([4,5,6])
print(np.concatenate((a,b)))
#stack function
print(np.stack((a,b)))
print(np.stack((a,b),axis=1))
#split function
a=np.array([1,2,3,4,5,6,7,8,9])
print(np.split(a,3))
print(np.split(a,[3,5]))
#sort function
a=np.array([1,2,3,4,5,6,7,8,9])
print(np.sort(a))
#reverse function
print(np.sort(a)[::-1])
#unique function
a=np.array([1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9])
print(np.unique(a))