保存
2019-08-01 本文已影响0人
夏弘毅
保存
all_index.to_pickle('all_index')
all_index = pd.read_pickle('all_index')
import pickle
with open('eods.pickle', 'w') as f: # Python 3: open(..., 'wb')
pickle.dump([locals()['eod_' + all_industry_index[i][4:6]] for i in range(len(all_industry_index))], f)
with open('eods.pickle') as f: # Python 3: open(..., 'rb')
obj0, obj1, obj2 = pickle.load(f)
保存变量
var_name = ['market_view_' + all_industry_index[i][0:8] for i in range(len(all_industry_index))]
import pickle
with open('market_views.bin','wb') as f:
pickle.dump(var_name,f)
with open('market_views.bin') as f:
var_name = pickle.load(f)