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 get the desired result, I had to enter:
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
This is mistake? Should the assignment automatically create a numpy array of type float?