SyntaxFix
Write A Post
Hire A Developer
Questions
Using np.ix_ is the most convenient way to do it (as answered by others), but here is another interesting way to do it:
np.ix_
>>> rows = [0, 1, 3] >>> cols = [0, 2] >>> a[rows].T[cols].T array([[ 0, 2], [ 4, 6], [12, 14]])