Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13891

ValueError: could not convert string to float: 'Pregnancies'

$
0
0
def loadCsv(filename):    lines = csv.reader(open('diabetes.csv'))    dataset = list(lines)    for i in range(len(dataset)):        dataset[i] = [float(x) for x in dataset[i]    return dataset

I'm trying to implement Naive-Bayes but its giving me this error even though I've manually changed the type of each column to float.it's still giving me error.

Above is the function to convert.


Viewing all articles
Browse latest Browse all 13891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>