尝试使用numpy的memmap从一个大文件中提取样本:
# indices - boolean vector indicating which lines we want to extract
file_big = np.memmap('path_big_file',dtype='int16',shape=(indices.shape[0],L))
file_small = np.memmap('new_path_for_small_file',dtype='int16',shape=(indices.sum(),L))
预期的结果是,将创建一个新文件,其中只包含索引标识的部分数据
# place data in files:
file_small[:] = file_big[indices]
以上是手册中描述的程序。它不工作-称为没有足够的内存,即使内存不应该是一个问题:只使用memmap而不上传数据
目前没有回答
相关问题 更多 >
编程相关推荐