将DataFrame转换为字典
参考文章 https://daixiang.blog.csdn.net/article/details/79634632
import numpy as np
import pandas as pd
N = 5
delta1 = np.random.normal(loc =0.0 , scale= 1.0,size = (N,))
delta2 = np.random.normal(loc =0.4 , scale= 2.0,size = (N,))
delta = {'delta1':delta1,'delta2':delta2}
df = pd.DataFrame(delta)
data = df.to_dict('list') # 注意要写上'list',否则转换出的字典会保留列序号
data['delta2']