我想在层次矩阵表中显示results_binary列表。
#initializing empty list objects for results
results_binary = []
# list of parameters
i_list = np.array([100, 1000, 10000]) # creating array with range of simulations
e_list = np.array([80, 100, 120])
np.random.seed(100)
for I in i_list: # simulation loop
S = mcs_simulation_EM((M, I)) # simulation
for E in e_list: # valuation loop
V0 = mcs_binary_new(E, option='call')
results_binary.append((E, I, V0))
df_results_binary = pd.DataFrame(results_binary, columns=["Simulations", "Strikes", "Values"])
df_results_binary
目标是按警示排序并删除索引列。
实际结果如下:
Simulations Strikes Values
0 80 100 0.922693
1 100 100 0.646836
2 120 100 0.285369
3 80 1000 0.898912
4 100 1000 0.628763
5 120 1000 0.295832
6 80 10000 0.888258
7 100 10000 0.624482
8 120 10000 0.289459