我正在尝试打开一个用于决策树学习的 CSV 数据集。当我运行代码时,结果出现值错误。我认为问题出在逗号上,但我不知道如何处理它。
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
from sklearn import metrics
col_names = ['pregnant', 'glucose', 'bp', 'skin', 'insulin', 'bmi', 'pedigree', 'age', 'label']
pima = pd.read_csv(r'D:\MachinLearning\MyDataSets_Implementations\pima-indians-diabetes.csv', header=None, names=col_names)
pima.head()
一些数据集行如下:
Pregnancies,Glucose,BloodPressure,SkinThickness,Insulin,BMI,DiabetesPedigreeFunction,Age,Outcome
6,148,72,35,0,33.6,0.627,50,1 1,85,66,29,0,26.6,0.351,31,0
8,183,64,0,0,23.3,0.672,32,1 1,89,66,23,94,28.1,0.167,21,0
0,137,40,35,168,43.1,2.288,33,1 5,116,74,0,0,25.6,0.201,30,0
天涯尽头无女友
相关分类