使用pytables或pandas删除表或节点后,释放hdf5磁盘内存 [英] Release hdf5 disk memory after table or node removal with pytables or pandas

查看:163
本文介绍了使用pytables或pandas删除表或节点后,释放hdf5磁盘内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将HDFStore与pandas/pytables一起使用.

I'm using HDFStore with pandas / pytables.

删除表或对象后,hdf5文件大小保持不变.以后,当添加其他对象来存储时,似乎会重用此空间,但是如果浪费了大空间,这可能是个问题.

After removing a table or object, hdf5 file size remains unaffected. It seems this space is reused afterwards when additional objects are added to store, but it can be an issue if large space is wasted.

我在pandas或pytables API中都没有找到可用于恢复hdf5内存的命令.

I have not found any command in pandas nor pytables APIs that might be used to recover hdf5 memory.

您知道有什么机制可以改善hdf5文件中的数据管理吗?

Do you know of any mechanism to improve data management in hdf5 files?

推荐答案

请参见这里

您需要ptrepack它,它会重写文件.

you need to ptrepack it, which rewrites the file.

ptrepack --chunkshape=auto --propindexes --complevel=9 --complib=blosc in.h5 out.h5

作为示例(这也会压缩文件).

as an example (this will also compress the file).

这篇关于使用pytables或pandas删除表或节点后,释放hdf5磁盘内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆