-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumPyOperations.py
More file actions
68 lines (47 loc) · 1018 Bytes
/
Copy pathNumPyOperations.py
File metadata and controls
68 lines (47 loc) · 1018 Bytes
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
62
63
64
65
66
67
68
import numpy as np
import matplotlib.pyplot as plt
a= np.array([(1,2,3,4,5),(4,5,6,7,8),(6,7,8,9,0)])
print(a)
#data size
print(a.itemsize)
print(a.dtype)
#dimention of the array
print(a.ndim)
#no of elemnts in the array
print(a.size)
#shape of the array
print(a.shape)
c=np.array([(2,3,4,5),(3,4,5,6)])
d=np.array([(9,8,7,4),(6,8,4,9)])
#resgaping the array
print(c.reshape(4,2))
print(d.reshape(8,1))
#slizing an array
print(c[0,3])
print(d[1,2])
print(c[0:,2])
a=np.linspace(2,4,9)
print(a)
#min and max of the array
print(c.max())
print(d.min())
#sum of the array
print(c.sum())
print(d.sum())
#axis sum
print(a.sum(axis=0))
print(c.sum(axis=0))
#sureroot and standred devisation
print(np.sqrt(c))
print(np.std(d))
#sum of the two arrays
print(c+d)
#print all values in single column
print(c.ravel())
#graph drwaing
x= np.arange(0,3*np.pi,0.1)
y= np.sin(x)
plt.plot(x,y)
plt.show()
ar = np.array([3,4,5,6])
print(np.log10(ar))