The following code fails:
from scipy import weave
from numpy import zeros
arr = zeros((10,2))
code = """
PyArray_Dims dims;
dims.len = 2;
dims.ptr = Narr;
dims.ptr[0] += 10;
PyArray_Resize(arr_array, &dims, 1);
"""
weave.inline(code, ['arr'], verbose=1)
The error message is:
In function 'PyObjec
> > The following line: array([6.95e-5]).astype('S')
> > returns: array(['6'], dtype='|S1')
> I don't know what it should do. Issue a warning, maybe?
> What are you trying to do?
At the very least a warning would not hurt. When I first started
using the numpy arrays it looked like conversion to
The following line: array([6.95e-5]).astype('S')
returns: array(['6'], dtype='|S1')
I realize that I can get it to return the correct string
representation if I specify 'S12', etc, but anything below 'S9'
results in an incorrect string representation of the number. Is this
expected behavior?
Th
> If you don't mind fancy indexing, you can convert your index arrays
> into boolean form:
> complement = A==A
> complement[idx] = False
This actually would work perfectly for my purposes. I don't really
need super-fancy indexing.
>> Given a slice, such as s_[..., :-2:], is it possible to take t
Given a slice, such as s_[..., :-2:], is it possible to take the
complement of this slice? Specifically, s_[..., ::-2]. I have a
series of 2D arrays that I need to split into two subarrays via
slicing where the members of the second array are all the members
leftover from the slice. The problem
In the following output (see below), why would x[1,None] work, but
x[1,None,2] or even x[1,2,None] not work?
Incidentally, I would be very interested in a solution that allows me to
index numpy arrays using a list/iterable that might contain None values. Is
there a straightforward way to do so,