from numpy import *
a=array([0.,0.001,0.002])
b=array([[1,11],[2,22],[3,33]])
b[:,1]=a
print b
I expected as a result:
array([[ 1. , 0. ],[ 2. , 0.001 ],[ 3. , 0.002 ]])
But I got:
array([[ 1 , 0 ], [ 2 , 0 ] , [ 3 , 0 ]])
To obtain desired result I had to type:
from numpy import *
a=array([0.,0.001,0.002])
b=array([[1,11],[2,22],[3,33]])
b=b.astype(float)
b[:,1]=a
print b
Is it a bug? Shouldn't assignment automatically make numpy array a float type?
int32array isn't compatible with that of afloat64array.