Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a question to numpy arrays using in IronPython. I have a problem assigning values to array with custom dtype. I'm using example from http://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html

dt = np.dtype([('name', np.str_, 16), ('grades', np.float64, (2,))])
x = np.array([('Sarah', (8.0, 7.0)), ('John', (6.0, 7.0))], dtype=dt)

When I want to assign values to the x array by:

x[1][1][:]=np.array([6.2,5.1])

or

x[1][1][0]=6.2

I get

Message: array is not writeable.

Could be the problem in using IronPython? Or am I doing something wrong?

share|improve this question
    
with CPython it works without any problems on my machine. It could be IronPython –  gg349 May 5 '14 at 13:42
    
Thanks @flebool. I thought, it could be the problem. So is there another way when I (probably) can't use custom dtype? –  frenezulo May 5 '14 at 13:56
    
@frenezulo did you try to use simply dtype=object? –  Saullo Castro May 7 '14 at 19:28
    
Yeah, @SaulloCastro, it came to my mind to use dtype=object. But I'm not sure now, it worked. I finally managed it with only one level of the array, eg. ('Sarah', 8.0, 7.0). –  frenezulo Jun 11 '14 at 9:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.