[Notes] pandas 保存hdf5时numpy array遇到的性能warning

当dataframe中有元素为numpy array时,进行pandas.HDFStore.put时会报warning:

your performance may suffer as PyTables will pickle object types that it cannot
map directly to c-types [inferred_type->mixed,key->block1_values]

这是因为Pandas所支持的数据类型:

  1. float
  2. int
  3. bool
  4. datetime64[ns]
  5. datetime64[ns, tz]
  6. timedelta[ns]
  7. category
  8. object

而numpy的array,python的string等无法直接映射为上述的结构,因此无法按照pandas的数据结构保存。
参考:https://blog.csdn.net/ls83776736/article/details/80738473?utm_medium=distribute.pc_relevant.none-task-blog-2~default~BlogCommendFromMachineLearnPai2~default-1.control&dist_request_id=&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2~default~BlogCommendFromMachineLearnPai2~default-1.control

这种情况下,会表示为object类型,以不定长的方式存储(存储指针)。

原文地址:https://www.cnblogs.com/immortalBlog/p/14636817.html