[英]How can I optimize file I/O in Python when I process GB-sized files via NFS?
I'm manipulating several files via nfs, due to security concerns.出于安全考虑,我正在通过 nfs 操作多个文件。 The situation is very painful to process something due to slow file I/O.由于文件 I/O 缓慢,处理某些事情的情况非常痛苦。 Followings are descriptions of the issue.以下是对该问题的描述。
read_csv()
and to_csv()
frequently.所以我经常使用read_csv()
和to_csv()
。Which approaches can I consider?我可以考虑哪些方法? In several cases, I use sqlite3 to manipulate data in simple way and exports results into csv files.在一些情况下,我使用 sqlite3 以简单的方式操作数据并将结果导出到 csv 文件中。 Can I accelerate I/O tasks by using sqlite3 in Python?我可以通过在 Python 中使用 sqlite3 来加速 I/O 任务吗? If it provide column-wise operation, it would be a good solution, I reckon.我认为,如果它提供按列操作,那将是一个很好的解决方案。
two options: pandas hdf5 or dask.两个选项:pandas hdf5 或 dask。
HDFStore supports another PyTables format on disk, the table format. HDFStore 支持磁盘上的另一种 PyTables 格式,即表格格式。 Conceptually a table is shaped very much like a DataFrame, with rows and columns.从概念上讲,表格的形状非常类似于 DataFrame,具有行和列。 A table may be appended to in the same or other sessions.可以在相同或其他会话中附加表。 In addition, delete and query type operations are supported.此外,还支持删除和查询类型的操作。 This format is specified by format='table' or format='t' to append or put or to_hdf.此格式由 format='table' 或 format='t' 指定以追加或放置或 to_hdf。
For purely improve IO performance, i think hdf with compress format is best.为了纯粹提高 IO 性能,我认为带有压缩格式的 hdf 是最好的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.