Reputation: 57
I have this code but in the result, the values are converted to integers. I want the real value. How? Thank you for your help.
import numpy as np
a=np.array([1,2,3,4])
f=np.array([0.00020,0.0001])
for i in range(2):
a[i]=f[i]
print(a)
# [0 0 3 4]
Upvotes: 3
Views: 668
Reputation: 3396
a
is an array of integers, you have to set it to a float array
a=np.array([1,2,3,4], dtype=float)
Upvotes: 2