[Numpy-discussion] Re: take for character arrays?
jmiller at stsci.edu
Thu Apr 15 13:29:11 CDT 2004
On Thu, 2004-04-15 at 16:17, Faheem Mitha wrote:
> On Thu, 15 Apr 2004, Todd Miller wrote:
> > Try this for a workaround:
> > s.swapaxes(0,1)
> > s = s.copy()
> > r = numarray.take(s, (1,2))
> > r.swapaxes(0,1)
> I was trying
> In : ts = numarray.transpose(s)
> In : numarray.take(ts,(1,2),axis=0)
> ValueError: Invalid destination array: partial indices require
> contiguous non-byteswapped destination
> In : tscopy = numarray.transpose(s).copy()
> In : numarray.take(tscopy,(1,2),axis=0)
> CharArray([['b', 'e', 'h'],
> ['c', 'f', 'i']])
> Is this the same or a related bug?
Same bug. Making a copy of the transposed array ensures that it (the
copy) is contiguous.
Todd Miller <jmiller at stsci.edu>
More information about the Numpy-discussion