[Numpy-discussion] Logical indexing and higher-dimensional arrays.

Jordi Gutiérrez Hermoso jordigh at octave.org
Tue Feb 7 12:11:34 EST 2012


Consider the following. Is this a bug?

Thanks,
- Jordi G. H.

-----------------------------------------------
#!/usr/bin/python

import numpy as np

x = np.reshape(np.random.uniform(size=2*3*4), [2,3,4])

idx = np.array([False, True, False, True])
y = x[0,:,:];

## Why is this transposed?
print x[0, :, idx].T == y[:, idx]

## This doesn't happen with non-boolean indexing
print x[0, :, 1:3] == y[:, 1:3]



More information about the NumPy-Discussion mailing list