-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray.py
More file actions
49 lines (39 loc) · 708 Bytes
/
Copy pathArray.py
File metadata and controls
49 lines (39 loc) · 708 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
import numpy as np
#Creating a 1-D Array (Vector)
a = np.array([1,2,3],dtype='int16') #Otherwise it would have been stored as int32
print(a)
#Creating a 2D array with floats
b = np.array([[1.0,2.0,3.0],
[3.0,5.0,8.0]])
print(b)
#Creating a Column Vector
c = np.array([
[1],
[2],
[3]
])
#Get Dimension
print(a.ndim)
print(b.ndim)
print(c.ndim)
#Get Shape
print(a.shape)
print(b.shape)
print(c.shape)
#Get Type
print(a.dtype)
print(b.dtype)
print(c.dtype)
#ItemsSize
print(a.itemsize)
print(b.itemsize)
print(c.itemsize)
#No. of Elements
print(a.size)
print(b.size)
print(c.size)
#Total Size
print(a.nbytes) #or print(a.size * a.itemsize)
print(b.nbytes)
print(c.nbytes)
#