以前正常工作的Jupyter Notebook单元现在崩溃

时间:2019-05-26 18:07:44

标签: python-3.x jupyter-notebook kernel pipenv

我的环境:pipenv> jupyter笔记本> python3

当前在以前已成功运行但不再运行的单元格中的数据集上运行.merge()。第一次合并有效,但第二次合并有问题(下面标记为full_df)。

在检查我的Mac的活动监视器时,似乎此代码占用了最多的内存。

当我中断内核时,会收到以下错误消息。

如何再次运行此代码?下面包含示例代码。

1)我试图完全关闭内核,这可以减轻我的记忆。 2)我考虑过try / except,但不能完全确定它是否允许输出,而是调整错误输出。 3)尝试在Spyder中运行,但不相信会解决任何问题-只是拼命。

df1 = pd.merge(df_ab, df_cd, left_on='ab_id', right_on='cd_id', how='left')

full_df = pd.merge(df1, df_ef, left_on='df1_id', right_on='ef_id', how='left')

当我让单元运行时,内核要么仍然很忙 要么 如果我在Spyder或Jupyter Notebook中关闭内核,重新打开,运行单元,然后中断,则会收到以下错误:


  File "<ipython-input-12-ac995c16c7cc>", line 1, in <module>
    full_df = pd.merge(df1, df_ef, left_on='df1_id', right_on='ef_id', how='left')

  File "/anaconda3/lib/python3.7/site-packages/pandas/core/reshape/merge.py", line 48, in merge
    return op.get_result()

  File "/anaconda3/lib/python3.7/site-packages/pandas/core/reshape/merge.py", line 560, in get_result
    concat_axis=0, copy=self.copy)

  File "/anaconda3/lib/python3.7/site-packages/pandas/core/internals/managers.py", line 2061, in concatenate_block_managers
    concatenate_join_units(join_units, concat_axis, copy=copy),

  File "/anaconda3/lib/python3.7/site-packages/pandas/core/internals/concat.py", line 242, in concatenate_join_units
    for ju in join_units]

  File "/anaconda3/lib/python3.7/site-packages/pandas/core/internals/concat.py", line 242, in <listcomp>
    for ju in join_units]

  File "/anaconda3/lib/python3.7/site-packages/pandas/core/internals/concat.py", line 225, in get_reindexed_values
    fill_value=fill_value)

  File "/anaconda3/lib/python3.7/site-packages/pandas/core/algorithms.py", line 1651, in take_nd
    out = np.empty(out_shape, dtype=dtype)

KeyboardInterrupt

0 个答案:

没有答案