Skip to content

Instantly share code, notes, and snippets.

View zhangyuteng's full-sized avatar

Oren Pasquin zhangyuteng

View GitHub Profile
@zhangyuteng
zhangyuteng / compressed_pickle.py
Created March 29, 2018 12:13 — forked from cwidmer/compressed_pickle.py
save/load compressed pickled objects in python
import cPickle
import bz2
def save(filename, myobj):
"""
save object to file using pickle
@param filename: name of destination file
@type filename: str
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

引言

刚看完"Python和HDF5打数据应用"这本书,该篇文章也是个人笔记,记录了h5py在使用时需要注意的性能问题。文章内容大多数摘自书中,代码部分做了略微调整。

本篇文章中,我们使用"h5py"模块来使用HDF5。该模块包含了文件、组、数据集以及特征等HDF对象的上层封装类,同时还包含了HDF5的C语言数据结构和函数的底层封装。

在后面的内容中,我们会着重讨论h5py使用中需要避开的性能问题,不会介绍它的基本用法。