我有一个使用genfromtxt
csv_file = np.genfromtxt(args.dataset, delimiter=',',skip_header=1,usecols=(0,1,2,3,4,5), dtype=None)
print(csv_file)
给出以下输出:
array([('X1.png', 'class1', 698, 333, 710, 358),
('X2.png', 'class2', 846, 391, 858, 411),
('X3.png', 'class3', 698, 337, 710, 357), ...,
('Xn.png', 'class4', 126, 95, 198, 225),
('Xn+1.png', 'class5', 74, 109, 143, 219),
('Xn+2.png', 'class3', 16, 104, 88, 224)],
dtype=[('f0', 'S32'), ('f1', 'S11'), ('f2', '<i8'), ('f3', '<i8'), ('f4', '<i8'), ('f5', '<i8')])
>>> img_name = csv_file[1]
>>> img_name
('x.png', 'class', 846, 391, 858, 411)
>>> type(img_name)
<type 'numpy.void'>
问题:我想将csv_file中的每一行拆分为数组中的不同列(比如Y)?