[Numpy-discussion] take behaviour has changed

Christian Kristukat ckkart at hoc.net
Fri Sep 22 21:00:04 CDT 2006


Travis Oliphant <oliphant.travis <at> ieee.org> writes:

> 
> Christian Kristukat wrote:
> > Bill Baxter <wbaxter <at> gmail.com> writes:
> >
> >   
> >> Yep, check the release notes:
> >> http://www.scipy.org/ReleaseNotes/NumPy_1.0
> >> search for 'take' on that page to find out what others have changed as well.
> >> --bb
> >>     
> >
> > Ok. Does axis=None then mean, that take(a, ind) operates on the
> > flattened array?
> > This it at least what it seem to be. I noticed that the ufunc behaves
> > differently. a.take(ind) and a.take(ind, axis=0) behave the same, so
> > the default
> > argument to axis is 0 rather than None.
> >   
> 
> What do you mean.  There is no "ufunc" take.  There is a function take 
> that just calls the method.  The default arguments for all functions 

Sorry, I never really read about what are ufuncs. I thought those are class
methods of the ndarray objects... Anyway, I was refering to the following
difference:

In [7]: a
Out[7]:
array([[ 0,  1,  2,  3,  4,  5],
       [ 6,  7,  8,  9, 10, 11]])

In [8]: a.take([0])
Out[8]: array([[0, 1, 2, 3, 4, 5]])

In [9]: take(a,[0])
Out[9]: array([0])

To be sure I understood: Does axis=None then mean, that take operates on the
flattened array?

Christian






More information about the Numpy-discussion mailing list