python - 缺少可选依赖项 'tables' 。在 Pandas to_hdf

标签 python pandas pip hdf5 pytables

  • 以下代码给我错误。
import pandas as pd
df = pd.DataFrame({'a' : [1,2,3]})
df.to_hdf('temp.h5', key='df', mode='w')

一些版本信息。

  • 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/

相关文章:

自动创建数据框的 Python Loop

python-2.7 - sudo pip install 的权限警告

python - 在 python 中安装 scipy 模块时出错

python - 安装 PyTorch 1.4 的问题 - "No matching distribution found for torch===1.4.0"

python - 打印 Tensor 时为 "args_0:0"

python - 如何在 Beautifulsoup Python 中实现 xpath 替代方案的跟随兄弟轴

python - 如果子字符串列表中的任何值包含在数据框中的任何列中,则过滤行

python - 将字典转换为平面数据结构(列表或元组)的有效方法

python - 如何转换转义字符?

python - 将列总计附加到 Pandas DataFrame