A colleague just showed me this indexing behavior and I was at a loss
to explain what was going on.  Can anybody else chime in and help me
understand this indexing behavior?

    >>> import numpy as np
    >>> np.__version__
    '1.7.1'
    >>> A = np.ones((2,3,5))
    >>> mask = np.array([True]*4 + [False], dtype=bool)
    >>> A.shape
    (2, 3, 5)
    >>> A[:,:,mask].shape
    (2, 3, 4)
    >>> A[:,1,mask].shape
    (2, 4)
    >>> A[1,:,mask].shape
    (4, 3) # Why is this not (3, 4)?
    >>> A[1][:,mask].shape
    (3, 4)

Thanks!
Brad
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to