我一直在尝试将图片附加到'样本'列表但所有文件都附加在样本[0]中。文件夹中总共有72个图像文件。在打印样本[1]时,IDE显示上述错误。这是我的代码 -
samples = []
files = glob.glob('Path_to_folder/*.png')
#print len(files) //prints 72
for myfile in files:
img = misc.imread(myfile)
img=(img[::2, ::2]/255.0).reshape(-1)
#print img //prints 72 rows with values like these - [ 0.01568627 0.01568627 0.01176471 ..., 0.05098039 0.05098039 0.04705882]
samples.append(img)
#print samples[1] //prints IndexError: ;list index out of range. While samples[0] prints all the files.
samples = pd.DataFrame(samples)