gpt4 book ai didi

pandas - 值错误 : key must be provided when HDF5 file contains multiple datasets while reading h5 file in pandas i am getting this error

转载 作者:行者123 更新时间:2023-12-01 01:41:24 25 4
gpt4 key购买 nike

在尝试读取 h5 文件时,出现以下错误:
ValueError: key must be provided when HDF5 file contains multiple datasets .

f=pd.read_hdf('file_path')

ValueError Traceback (most recent call last)

384 for group_to_check in groups[1:]:
385 if not _is_metadata_of(group_to_check, candidate_only_group):

--> 386 raise ValueError('key must be provided when HDF5 file '
387 'contains multiple datasets.')
388 key = candidate_only_group._v_pathname

ValueError: key must be provided when HDF5 file contains multiple datasets.

任何人都可以向我发送完整的代码,以便我可以解决此错误并在 pandas 中工作?

最佳答案

正如@AT_asks 在评论中提到的,您必须提供要在 H5 文件中打开的组的名称。如果您不知道名称可能是什么,您可以查看文件包含哪些组:

with pd.HDFStore('file_path') as hdf:
# This prints a list of all group names:
print(hdf.keys())


选择一个组名,然后使用 key 打开它 read_hdf的参数:
f = pd.read_hdf('file_path', key='your_group')

关于pandas - 值错误 : key must be provided when HDF5 file contains multiple datasets while reading h5 file in pandas i am getting this error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56323894/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com