Pickle

pickleの使用方法

Saving

with openでの保存、読み込み

with open("filename.pkl", "wb") as f:
    pickle.dump(data, f)
with open("filename.pkl", "rb") as f:
    hoge = pickle.load(f)

pandasでの保存、読み込み

import pandas as pd
pd.to_pickle(data, "filename.pkl")
hoge = pd.read_pickle("filename.pkl")

joblib(?)での保存、読み込み

joblib.dump(data, "filename.jb", compress=3)
hoge = joblib.load("filename.jb")