Reputation: 537
I have a csv file, which has one row with many data. The problem is that this data is float, something like this (7.66907027311089). I use this code to import this data:
with open('Sygnal2.txt','r') as csvfile:
plots = csv.reader(csvfile, delimiter=',')
for row in plots:
y.append(int(float(row[0])))
Even when I use float
, when I print y
I got a list of no float numbers. Any ideas how to change it?
Upvotes: 0
Views: 138
Reputation: 51683
You are converting twice - first you make a float
from your string
, and then an int
from your float
- simply do:
y.append(float(row[0]))
Upvotes: 1