Try to search your question here, if you can't find : Ask Any Question Now ?

Python array indexed with list but array dimensions are permuted

HomeCategory: stackoverflowPython array indexed with list but array dimensions are permuted
gaurav asked 2 weeks ago

I try to index an array (has five dimensions) using a list. However, under certain situation, the array is permuted.

Say, a has the shape of (3,4,5,6,7), i.e.,

>>> a = np.zeros((3,4,5,6,7))
>>> a.shape
(3, 4, 5, 6, 7)

Using a list to index this array on the third dimension, it looks normal:

>>> a[:,:,[0,3],:,:].shape
(3, 4, 2, 6, 7)

However, if the array were indexed under the following situation, the third dimension is permuted to the leftmost:

>>> a[0,:,[0,1],:,:].shape
(2, 4, 6, 7)

Can anyone shed some light on it?

1 Answers
Best Answer
Mannu answered 2 weeks ago
Your Answer

15 + 4 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com