我有一个数组,但是我需要把它转换成一个 11x11 的矩阵,怎么做呢?
d = {'Ambev': retornoAmbev, 'Bardell': retornoBardell,
'Bombril': retornoBombril,'Braskem': retornoBraskem,
'Petrobras': retornoPetrobras,'Vale': retornoVale,
'Ibovespa': retornoIbovespa,'Poupança': retornoPoupança,
'CDI': retornoCDI,'SELIC': retornoSelic}
df = pd.DataFrame(data=d)
pdCOV = df.cov()
array_matrix = np.array(pdCOV.to_records().view(type=np.matrix))
print(array_matrix)
[[('**Ambev**', 0.08289085, -0.01172982, 4.95575325e-02,
-0.06989391, -0.01660989, 0.01540076, -1.53656407e-03, -0.00048712, -0.00114877, -0.00252005) ('**Bardell**', -0.01172982, 0.23285772, -2.21704237e-02, 0.21875916, 0.09834272, 0.09632943, 1.00698681e-01, -0.0010374 , -0.00328011, -0.0007994 ) ('**Bombril**', 0.04955753, -0.02217042, 6.42064182e-01,
-0.10951718, -0.0422506 , 0.05588981, -1.20970487e-02, -0.00015539, 0.00085053, -0.00155864) ('**Braskem**', -0.06989391, 0.21875916, -1.09517183e-01, 2.54048926, 0.3457639 , 0.2842912 , 4.64263877e-01, -0.00413512, 0.00493075, 0.0184824 ) ('**Petrobras**', -0.01660989, 0.09834272, -4.22505956e-02,
0.3457639 , 0.14561048, 0.09786241, 1.17554252e-01, 0.00035834, 0.00462521, 0.00829757) ('**Vale**', 0.01540076, 0.09632943, 5.58898052e-02, 0.2842912 , 0.09786241, 0.15037262, 1.11523118e-01, 0.0020628 , 0.00724026, 0.00776359) ('**Ibovespa**', -0.00153656, 0.10069868, -1.20970487e-02, 0.46426388, 0.11755425, 0.11152312, 1.41349400e-01, -0.00066876, -0.00019338, 0.0018708 ) ('**Poupança**', -0.00048712, -0.0010374 , -1.55391386e-04,
-0.00413512, 0.00035834, 0.0020628 , -6.68759784e-04, 0.00021038, 0.00061894, 0.00042819) ('**CDI**', -0.00114877, -0.00328011, 8.50527467e-04, 0.00493075, 0.00462521, 0.00724026, -1.93383326e-04, 0.00061894, 0.00221491, 0.00196327) ('**SELIC**', -0.00252005, -0.0007994 , -1.55863971e-03, 0.0184824 , 0.00829757, 0.00776359, 1.87080325e-03, 0.00042819, 0.00196327, 0.00255616)]]