Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 从一个大小为x的数组创建一个形状框架(x**0.5,x**0.5)_Python_Pandas - Fatal编程技术网

Python 从一个大小为x的数组创建一个形状框架(x**0.5,x**0.5)

Python 从一个大小为x的数组创建一个形状框架(x**0.5,x**0.5),python,pandas,Python,Pandas,我有一个大小为64的数组,例如: In[164]: x_y.values / x_ysquare.stack().values Out[164]: array([ 1. , 0.01623716, -0.03305102, 0.03264311, -0.0175754 , 0.04017079, 0.15731795, -0.01797369, 0.01623716, 1. , 0.08387368, -0.09562322

我有一个大小为64的数组,例如:

In[164]: x_y.values / x_ysquare.stack().values
Out[164]: 
array([ 1.        ,  0.01623716, -0.03305102,  0.03264311, -0.0175754 ,
        0.04017079,  0.15731795, -0.01797369,  0.01623716,  1.        ,
        0.08387368, -0.09562322,  0.02700502,  0.0614588 ,  0.03461564,
       -0.12421004, -0.03305102,  0.08387368,  1.        , -0.00248859,
       -0.00391474,  0.01603743,  0.05942098,  0.08989135,  0.03264311,
       -0.09562322, -0.00248859,  1.        , -0.16354249, -0.00887474,
        0.30343543,  0.12873483, -0.0175754 ,  0.02700502, -0.00391474,
       -0.16354249,  1.        ,  0.02347214, -0.30337839, -0.09302462,
        0.04017079,  0.0614588 ,  0.01603743, -0.00887474,  0.02347214,
        1.        , -0.01125003, -0.31859215,  0.15731795,  0.03461564,
        0.05942098,  0.30343543, -0.30337839, -0.01125003,  1.        ,
        0.18483076, -0.01797369, -0.12421004,  0.08989135,  0.12873483,
       -0.09302462, -0.31859215,  0.18483076,  1.        ])
我正在尝试从这64个数据创建一个8x8大小的熊猫数据帧

这是一个相关矩阵,我强制平均值为0,我试图得到完全相同的输出形状,就像我使用df.corr()方法一样

谢谢你的帮助

也许你可以做:

arr_reshaped = arr.reshape(8,8)

df = pd.DataFrame(arr_reshaped)