- 以下代码给我错误。
import pandas as pd
df = pd.DataFrame({'a' : [1,2,3]})
df.to_hdf('temp.h5', key='df', mode='w')
这给我错误。
Missing optional dependency 'tables'. Use pip or conda to install tables.
我已经试过了 ImportError HDFStore requires PyTables No module named tables .还是一样的错误。
我在读取 hdf 文件时遇到同样的错误。并且已经为我的 python 安装了
tables
。
一些版本信息。
- python 3.7.4
- pandas 0.25.2
- windows10
PS:您可以在 repl
中重现此内容 https://repl.it/ .
更新:
- 我试过运行。
import tables
得到这个错误:
ImportError: Could not load any of ['hdf5.dll', 'hdf5dll.dll'], please ensure that it can be found in the system path.
pandas 似乎没有给出准确的信息。它只是在实际存在时说缺少依赖性。
如果有人知道如何解决这个问题。这会有所帮助。
最佳答案
对于 conda 用户:
conda install pytables
关于python - 缺少可选依赖项 'tables' 。在 Pandas to_hdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58479748/