I think you just can't use newaxis in advanced indexing (doc says "The newaxis<http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#numpy.newaxis>object can be used in the basic slicing syntax", and does not mention newaxis in the advanced indexing part).
-=- Olivier Le 1 février 2012 04:25, Mark Bakker <mark...@gmail.com> a écrit : > Hello list, > > I am trying to specify the indices of an array with a list and add a > newaxis, but that combination doesn't seem to be allowed. Any reason why? > Here's an example: > > a = arange(3) > > This works: > > a[[0,2]][:,newaxis] > Out[445]: > array([[0], > [2]]) > > This is more elegant syntax (and, I thought, correct), but it doesn't work: > > a[[0,2],newaxis] > --------------------------------------------------------------------------- > TypeError Traceback (most recent call last) > /Users/mark/ttim/svn/trunk/<ipython-input-444-b37a4cca4311> in <module>() > ----> 1 a[[0,2],newaxis] > > TypeError: long() argument must be a string or a number, not 'NoneType' > > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion