万圣节的熊猫和 HDF 有一些令人毛骨悚然的东西:
df = pandas.DataFrame([['a','b'] for i in range(1,1000)])
store = pandas.HDFStore('test.h5')
store['x'] = df
store.close()
然后
ls -l test.h5
-rw-r--r-- 1 arthur arthur 1072080 Oct 26 10:50 test.h5
1.1M?有点陡峭,但为什么不呢。这就是事情变得非常诡异的地方
store = pandas.HDFStore('test.h5') #open it again
store['x'] = df #do the same thing as before!
store.close()
然后
ls -l test.h5
-rw-r--r-- 1 arthur arthur 2122768 Oct 26 10:52 test.h5
你现在已经进入了暮光区。不用说,运行后store是没有区别的,但是每次迭代都让文件变胖了一点。
似乎只有在涉及字符串时才会发生。在我提交错误报告之前,我想知道我是否在这里遗漏了什么......