WorksheetsNumpy
Total questions: 10
Worksheet time: 5mins
What is a correct syntax to create a NumPy array?
np.array([1, 2, 3, 4, 5])
np.object([1, 2, 3, 4, 5])
np.createArray([1, 2, 3, 4, 5])
Which of the following arrays is a two dimensional (2-D) array?
[1, 2, 3, 4, 5]
[[1, 2, 3], [4, 5, 6]]
42
What is a correct syntax to print the first item of an array?
print(myArr,1)
print(myArr[0])
print(myArr[1])
Which syntax would print every other item from the array below:
arr = np.array([1,2,3,4,5,6,7])
print(arr[1:3:5:7])
print(arr(0: step = 2))
print(arr[::2])
What is a correct syntax to print the number 8 from the array below:
arr = np.array([[1,2,3,4,5], [6,7,8,9,10]])
print(arr[1, 2])
print(arr[7, 2])
print(arr[3, 0])
Which syntax would print the last 4 numbers from the array below:
arr = np.array([1,2,3,4,5,6,7])
print(arr[4])
print(arr[3:])
print(arr[4:])
print(arr[:4])
Which syntax would print every other item from the array below:
arr = np.array([1,2,3,4,5,6,7])
print(arr[1:3:5:7])
print(arr(0: step = 2))
print(arr[::2])
What is a correct syntax to create a Pandas Series from a Python list?
pd.getSeries(mylist)
pd.createSeries(mylist)
pd.Series(mylist)
What is a correct syntax to return the first value of a Pandas Series?
get(myseries, 0)
myseries[0]
myseries.get(0)
What is a correct syntax to add the lables "x", "y", and "z" to a Pandas Series?
pd.Series(mylist, names = ["x", "y", "z"])
pd.Series(mylist, lables = ["x", "y", "z"])
pd.Series(mylist, index = ["x", "y", "z"])
