我只想从numpy数组中的文件中读取4个整数(矩阵4个列,很多行)。
数据如下:
74 85 123 1
73 84 122 1
72 83 121 1
70 81 119 1
70 81 119 1
69 80 118 1
70 81 119 1
代码:
data = np.genfromtxt('Skin_NonSkin.txt', dtype=(int, int, int, int), delimiter=' ')
但我收到错误
data = np.genfromtxt('Skin_NonSkin.txt', dtype=(int, int, int, int), delimiter=' ')
File "C:\Anaconda\lib\site-packages\numpy\lib\npyio.py", line 1760, in genfromtxt
rows = np.array(data, dtype=[('', _) for _ in dtype_flat])
ValueError: size of tuple must match number of fields.