【发布时间】:2015-04-17 13:25:04
【问题描述】:
例如,我有以下表格描述。在 SpectrumL 中,我想存储一个我还不知道确切大小的(频谱图)。同样,我想存储一些标签(将是字符串),它们的大小会因记录而异。但是,当我尝试为此执行构建语句时,出现以下错误:
TypeError: Passing an incorrect value to a table column. Expected a Col (or subclass) instance and got: "StringAtom(itemsize=20, shape=(), dflt='')". Please make use of the Col(), or descendant, constructor to properly initialize columns.
我正在执行的语句是:
h5file = tables.open_file("foo.h5", mode = "w", title = "Datastore")
group = h5file.create_group("/", 'metadata', 'General MetaData')
table = h5file.create_table(group, 'footer', hdf5Pull.BuildTable, "information")
表语句类为:
class BuildTable(IsDescription):
artist_id = StringCol(100)
tags = StringAtom(itemsize = 20)
spectrumL = Float64Atom((5000, 1))
spectrumR = Float64Atom((5000, 1))
frequency = Float64Atom((5000, 1))
有人能帮忙看看这个吗?我在理解文档时遇到了一些麻烦。谢谢!
【问题讨论】:
标签: python database hdf5 pytables