So I am trying to make sure that all the values that I have in the csv file are converted into float. The values in each cell inside the csv file are just numbers like for example "0.089" "23". For some reason when I try to run the code it is giving the following error, " ValueError: could not convert string to float: '.' " I can not really understand why the program is not reading the numbers from the csv file properly.
def loadCsv(filename):
with open('BreastCancerTumor.csv','r') as f:
lines = f.readlines()[1:]
dataset = list(lines)
for i in range(len(dataset)):
dataset[i] = [float(x) for x in dataset[i]]
return dataset
.to a float.dataset[I]? What isIhere?linesis already a list, there's no need to writelist(lines)