Question: Numpy Index Exercise ( need assistance with 4 questions highlighted in red please) Indexing In [5]: #You are given the following 2D array a =

Numpy Index Exercise ( need assistance with 4 questions highlighted in red please)

Numpy Index Exercise ( need assistance with 4 questions highlighted in redplease) Indexing In [5]: #You are given the following 2D array a

Indexing In [5]: #You are given the following 2D array a = np.arange (1,25).reshape(4,-1) a Out[5]: array([[ 1, 2, 3, 4, 5, 6], [ 7, 8, 9, 10, 11, 12), [13, 14, 15, 16, 17, 18), [19, 20, 21, 22, 23, 24]]) In [6]: # Use array indexing to select the subset that contains 9,10,11,12,15,16,17,18, 21, 22, 23, 24. # In other words, the 3 * 4 sub-matrix in the bottom right corner of your array # I have shown you the output -- be careful, if you run your code, it is going to "wipe out" my output Out[6]: array([[ 9, 10, 11, 12], [15, 16, 17, 18), [21, 22, 23, 24]]) In [10]: # Use array indexing get the value 20, as my output shows Out[10]: 20 In [8]: # Use array indexing get the column 10, 16, 22, as my output shows Out[8]: array([[10], [16], [22]]) In [9]: # Use array indexing get the row (15,16,17] as my output shows Out[9]: array([[15, 16, 17]])

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!