Reputation: 173
I initialize
Tcoords = np.array([0,0])
and
Tcoords[0] =.1
but why when printing Tcoords still
Tcoords
array([0, 0])
Upvotes: 1
Views: 72
Reputation: 1803
Use float instead of int. It will work:
Tcoords = np.array([0.0,0.0])
Upvotes: 1
Reputation: 85482
The assigned 0.1
will be cast into an integer. Use:
>>> Tcoords = np.array([0,0], dtype=np.float)
>>> Tcoords[0] = .1
>>> Tcoords
array([ 0.1, 0. ])
This is what happens:
>>>int(0.1)
0
Upvotes: 2