【发布时间】:2018-07-01 17:49:11
【问题描述】:
我正在尝试计算数据框中每对可能的两列的 pearsons 相关性。我有 57997 列。但是我遇到了内存错误。
t_logs = logs.T
print t_logs
results = t_logs.corr(method='pearson').applymap
print results[enter image description here][1]
这是回溯
---------------------------------------------------------------------------
MemoryError Traceback (most recent call last)
<ipython-input-99-d0010a131d17> in <module>()
5 print logs
6
----> 7 results = t_logs.corr(method='pearson')
8 print results
C:\Users\nne1s\Anaconda2\lib\site-packages\pandas\core\frame.pyc in
corr(self, method, min_periods)
4938
4939 if method == 'pearson':
-> 4940 correl = libalgos.nancorr(_ensure_float64(mat),
minp=min_periods)
4941 elif method == 'spearman':
4942 correl = libalgos.nancorr_spearman(_ensure_float64(mat),
pandas\_libs\algos.pyx in pandas._libs.algos.nancorr
(pandas\_libs\algos.c:15501)()
MemoryError:
【问题讨论】:
-
你的开发环境有多少内存
-
请不要张贴代码图片或错误信息。而是在 SO 上发布完整的回溯。 The reason for this is explained here.
-
@Piinthesky 我添加了回溯
标签: python vectorization data-analysis pearson-correlation