import numpy as np import codecs f=codecs.open('testsklearn.txt','r','utf-8').readlines() print(f) dataset=list() for i in f: list_data= i.split(',') List=list(); for j in list_data: data=float(j) List.append(data) dataset.append(List) dataset1=np.array(dataset) print(type(dataset1)) X = dataset1[:,0:7] y = dataset1[:,8]