在pandas hdfstore中重命名表

Luk*_*uke 6 python pytables pandas

我正在使用pandas使用HDFStore加入几个巨大的csv文件.我正在将所有其他表合并到基表中base.现在我在HDFStore中为每个合并的输出创建一个新表,我称之为temp.然后我删除旧的基表.最后,我复制tempbase一遍又一遍在邻桌我需要加入启动进程.

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

Dan*_*lan 7

对的,这是可能的.你必须深入研究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])
Run Code Online (Sandbox Code Playgroud)

相同的方法适用于frame_table可附加节点.