我正在编写一个代码,它创建了一个HDF5,以后可以用于数据分析。我加载以下软件包:
import numpy as np
import tables然后,我使用tables模块来确定我的文件是否是一个HDF5文件,其中包括:
tables.isHDF5File(FILENAME)这通常会打印为真或假,这取决于文件类型是否实际上是一个HDF5文件。但是,我得到了错误:
AttributeError:模块“表”没有属性“isHDF5File”
所以我试着:
from tables import isHDF5File得到了错误:
ImportError:无法导入名称“isHDF5File”
我在另一台电脑上试过这段代码,运行得很好。我尝试用pip更新numpy和表,但是它声明该文件已经更新了。对我来说,“桌子”不认识“isHDF5File”有什么原因吗?我正在Mac上运行这段代码(不工作),但它在PC上工作(如果这很重要)。
发布于 2017-03-15 21:11:23
你的函数名对吗?
In [21]: import tables
In [22]: tables.is_hdf5_file?
Docstring:
is_hdf5_file(filename)
Determine whether a file is in the HDF5 format.
When successful, it returns a true value if the file is an HDF5
file, false otherwise. If there were problems identifying the file,
an HDF5ExtError is raised.
Type: builtin_function_or_method
In [23]: https://stackoverflow.com/questions/42819162
复制相似问题