HDFStore sys:1:性能警告 - 您的性能可能会受到影响,因为 PyTables 会腌制它无法处理的对象类型

问题描述

我想在 hdfstore 中存储大量数据(约 500 万行)。

我收到此性能警告Ö

sys:1: PerformanceWarning: 
your performance may suffer as PyTables will pickle object types that it cannot
map directly to c-types [inferred_type->mixed,key->block1_values] [items->Index(['cards','position','points'],dtype='object')]

这是我的代码一个非常简单的版本,可以重现该错误

import pandas as pd

protocol = [[None,None],[0,2],None,None]
game = [0,2]
position = 2
result = 111
cards = [[0,0],[1,3],[3,7],6],1]]

columns = ['cards','protocol','label','points']

tupel = [(protocol,game,position,result,cards),(protocol,cards)]

games_data = pd.DataFrame(data=tupel,columns=columns)
print(games_data.info())

store = pd.hdfstore(f'store.h5')

store['games_data_str'] = games_data

store.close()

hdfstore 用于存储列表和列表列表的结构是否错误

感谢您的帮助!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)