Question: All these questions relate to Python. 1 . Which of the following code segments will use vectorisation to reduce the time taken to calculate the
All these questions relate to Python.
Which of the following code segments will use vectorisation to reduce the time taken to calculate the sum of two NumPy arrays: A and BSelect ALL that apply
a AtolistBtolist
b A B
c npaddA B
d C npemptyAsize
for index in rangeAsize:
Cindex Aindex Bindex
If two arrays of different dimensions are multiplied together, what is the result?
a NumPy will return an error.
b The result will have the shape to fit the largest array dimensions and fill missing values with NaN.
c NumPy will treat the missing values as copying the values of the larger arrays
d The result will have the shape to fit the smallest array dimensions and fill missing values with NaN.
Which of the hsplit calls shown will result in the arrays A B and C having the values shown in the picture?
Original array: O
A
B
C
a ABC nphsplitO
b ACB nphsplitO
c ABC nphsplitO
d ACB nphsplitO
The line nprandom.random will produce which of the following?
a A onedimensional array of NaNs
b A onedimensional array of values between and
c A onedimensional array of integers between and
d A onedimensional array of zero values
Objects can be changed or accessed through their property attributes or through their methods. For each of the following manipulations of NumPy arrays, identify if you can achieve the goal through the NumPy array property attribute, method or both.
To answer: select "property", "method" or "both" from below.
a Access shape
Both
Method
Property
b Change shape
Both
Method
Property
c Sum values
Both
Method
Property
d Find minimum value
Both
Method
Property
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
