python做个sns.clustermap,前期计算linkage
Zy = linkage(df2, method='ward', metric='euclidean',optimal_ordering=True)
一直报错
Zy = linkage(df2, method='ward', metric='euclidean',optimal_ordering=True)
Traceback (most recent call last):
File "<ipython-input-394-8574af88f26d>", line 1, in <module>
Zy = linkage(df2, method='ward', metric='euclidean',optimal_ordering=True)
File "C:\Users\HJD\anaconda3\lib\site-packages\scipy\cluster\hierarchy.py", line 1060, in linkage
y = distance.pdist(y, metric)
File "C:\Users\HJD\anaconda3\lib\site-packages\scipy\spatial\distance.py", line 2023, in pdist
dm = np.empty((m * (m - 1)) // 2, dtype=np.double)
MemoryError: Unable to allocate 5.22 GiB for an array with shape (700895520,) and data type float64
Zy = linkage(df2, method='ward', metric='euclidean')
Traceback (most recent call last):
File "<ipython-input-393-2944cd50857d>", line 1, in <module>
Zy = linkage(df2, method='ward', metric='euclidean')
File "C:\Users\HJD\anaconda3\lib\site-packages\scipy\cluster\hierarchy.py", line 1074, in linkage
result = _hierarchy.nn_chain(y, n, method_code)
File "_hierarchy.pyx", line 929, in scipy.cluster._hierarchy.nn_chain
File "stringsource", line 249, in View.MemoryView.array_cwrapper
File "stringsource", line 176, in View.MemoryView.array.__cinit__
MemoryError: unable to allocate array data.
baidu google查了一大堆,,最后还是换了一台大内存(96G)的机器解决了
真的是内存小了,数组放不下..用的16G的电脑,,不行啊