Numpy Flashcards
1
Q
How do you import numpy?
A
import numpy as np
2
Q
Create an array of 8 zeros for variable a
A
a = np.zeros(8)
3
Q
Create an array with 3 rows and 5 columns
A
a.shape(3, 5)
4
Q
How would you get the first element of an array “a”?
A
a[0]
5
Q
How would you get the last element of an array “b”?
A
b[-1]
6
Q
How would you get all the elements of array “d”?
A
d[:]
7
Q
How would you get the greatest number from an array?
A
my_array.max()
8
Q
How would you get the smallest number from an array?
A
my_array.min()