Answer to Question #264428 in Organic Chemistry for Krishna priya

Question #264428

If a is numpy array of shape (5,3) and b is of shape (2,4),what is the shape of a (b)?

1
Expert's answer
2021-11-12T07:01:01-0500

Assuming the elements of b are valid indices into rows of a, then a[b] will be a 3D array with shape (2,4,3). In your example, that means b should be an integer array with values between -5 and 4 inclusive, else indexing a[b] will raise IndexError. The result a[b] will be made up of the corresponding rows from a, stacked in depth.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS