NumPy Presentation
NumPy Presentation
• Check version:
• import numpy as np
• print(np.__version__)
Creating Arrays
• import numpy as np
• a = np.array([1, 2, 3])
• b = np.array([[1, 2], [3, 4]])
• Matrix multiplication:
• np.dot(a, a)
Indexing and Slicing
• a[0:2]
• b[:, 0]
• a[a > 1]
Reshaping and Transposing
• c = np.arange(6).reshape(2, 3)
• c.T
Broadcasting
• a+5