我正在尝试使用香蕉SSL数据集在python3中构建半监督分类器(kNN)。但是我无法加载数据。
我尝试了熊猫的read_csv()函数
data = read_csv('banana-ssl10-10-1tra.dat', index_col=0, sep=',')
我收到此错误消息“ pandas.errors.ParserError:标记数据时出错。C错误:第4行中应有2个字段,看到3个”
和numpy的getfromtxt()函数
data = np.genfromtxt('banana-ssl10-10-1tra.dat',
skip_header=1,
skip_footer=1,
names=True,
delimiter=',')
我收到此错误“ ...行#4775(得到3列而不是2列)” 这是“ banana-ssl10-10-1tra.dat”数据集中的几行内容:
@relation banana
@attribute At1 real[-3.09,2.81]
@attribute At2 real[-2.39,3.19]
@attribute Class {-1.0,1.0, unlabeled}
@inputs At1, At2
@outputs Class
@data
-0.239, -0.619, -1.0
1.37, -0.331, 1.0
-1.74, 0.697, -1.0
1.15, -1.52, 1.0
0.308, -1.34, -1.0
1.05, 0.453, -1.0
1.01, 0.555, -1.0
...
0.924, 0.861, unlabeled
-1.1, 1.16, unlabeled
0.422, -0.934, unlabeled
-0.209, 0.345, unlabeled
0.434, 2.19, unlabeled
0.412, -0.124, unlabeled
1.02, 0.0975, unlabeled
1.09, 0.614, unlabeled
-0.794, 1.07, unlabeled
1.23, -1.2, unlabeled
-1.07, -0.616, unlabeled
-1.32, -0.403, unlabeled
-1.94, 0.832, unlabeled
您能告诉我如何在python3中正确加载吗?