def loadData(fileName):
x = []
y = []
fl = csv.reader(open(fileName,'r'))
x = list(fl)
y.append([row[13] for row in fl])
return x, y
I use this but got y is empty, my csv data is enter image description here
我想让x是所有行,而y输出[19.2,20.8]
您需要像对y一样遍历csv文件中的行。
Please note that its recommend to use
with
-Syntax for file readersAn Example for the CSV Reader from the docs: