使用Jupyter Notebook执行内部联接时遇到内存错误

时间:2019-07-09 09:04:31

标签: python-3.x pandas jupyter-notebook ipython

在Jupyter Notebook上执行内部联接时,遇到内存错误。

我正在使用以下版本:

服务器信息:

You are using Jupyter notebook.
The version of the notebook server is: 5.7.8

服务器正在此版本的Python上运行:

Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)]
Current Kernel Information:
Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help. 

这是我遇到问题的代码:

MDSp = pd.merge(MDS,p,on=['Col1'],how='inner')

MDS = 341232 rows and 9 columns
p = 6890 rows and 11 columns

MDS = Col1 Col2 Col9
      1     a     b
      1     c     d
      2     e     f
      2     g     h

p = Col1 Colx Colz
      1     f   4
      1     g   3
      2     h   2
      2     l   1

MDSp = Col1 Col2 Col9 Colx Colz
       1    a     b    f   4
       1    a     b    g   3
       1    c     d    f   4
       1    c     d    g   3
       2    e     f    h   2
       2    e     f    l   1
       2    g     h    h   2
       2    g     h    l   1

这是我得到的错误:

MemoryError Traceback (most recent call last)
<ipython-input-7-37aa1a1efc01> in <module>
    145 
--> 146     MDSp = pd.merge(MDS ,p,on=['Col1'],how='inner')

0 个答案:

没有答案