-
Notifications
You must be signed in to change notification settings - Fork 0
/
1-basics.py
40 lines (35 loc) · 904 Bytes
/
1-basics.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
# import numpy as np
# Note! remember through out the crash course
# np arrays behaves like matrix
# return current version of numpy you're using
# print(np.__version__)
# # creates 1-d array
# a = np.array([1,2,3])
# print(a)
# # return array shape in (rows, columns)
# print(a.shape)
# # return data type
# print(a.dtype)
# # return dimension of the array as it is 1 dimesional array
# print(a.ndim)
# # return array size
# print(a.size)
# # return size of each element as its data type is int64 mean 64 bits = 8 byte
# print(a.itemsize)
# return value at index a[0]
# print(a[0])
# # set the value at specific index
# a[0] = 10
# # Some Basic Mathematical operations
# a = [1, 2, 3]
# print(a + 2)
# print(a - 2)
# print(a * 2)
# print(a / 2)
# # Some Mathematical operations between Arrays
# # a = [1, 2, 3]
# b = np.array([4, 5, 6])
# print(b + a)
# print(b - a)
# print(b * a)
# print(b / a)