HDF5选项卡中的视图列

2024-05-18 23:26:43 发布

您现在位置:Python中文网/ 问答频道 /正文

目前,我可以查看HDF5存储中的每个表以及该表中的数据。你知道吗

with pd.HDFStore(left_file, 'r') as hdf:
   tables = hdf.keys()
   for table in tables:
       print(hdf.select('{0}'.format(table))

但是我怎样才能得到每个表中列的列表呢?你知道吗


Tags: 数据infortablesaswithtablekeys
1条回答
网友
1楼 · 发布于 2024-05-18 23:26:43

多亏了这些视频,我对熊猫的了解才有了一点提高。https://www.youtube.com/user/DrNoureddinSadawi/videos

这是我的解决办法。它列出了表及其列标题。你知道吗

with pd.HDFStore(hdfs_file, 'r') as hdf:
    tables = hdf.keys()
    for table in tables:
        print(table)
        table_data = hdf.get(table)
        column_list = table_data.columns.values
        for column in column_list:
            print(" - {0}".format(column))

相关问题 更多 >

    热门问题