gpt4 book ai didi

python - 重命名 pandas hdfstore 中的表

转载 作者:太空狗 更新时间:2023-10-30 01:01:44 26 4
gpt4 key购买 nike

我正在使用 pandas 通过 HDFStore 加入几个巨大的 csv 文件。我正在将所有其他表合并到一个基表 base。现在我在 HDFStore 中为每次合并的输出创建一个新表,我称之为 temp。然后我删除旧的基表。最后,我将 temp 复制到 base 并在我需要加入的下一个表上重新开始该过程。

如果我可以简单地将 temp 重命名为 base,这会更有效率。这可能吗?

最佳答案

是的,这是可能的。你必须深入研究 methods from PyTables , HDFStore 依赖于它。

Out[20]: 
<class 'pandas.io.pytables.HDFStore'>
File path: test.h5
/a frame (shape->[3,1])

In [21]: store.get_node('a')._f_rename('b')

In [22]: store
Out[22]:
<class 'pandas.io.pytables.HDFStore'>
File path: test.h5
/b frame (shape->[3,1])

同样的方法适用于 frame_table 可追加节点。

关于python - 重命名 pandas hdfstore 中的表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22797923/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com