The kernel has died and will restart automatically

Dear colleagues,
I did find some questions with the same title as mine, but they seem to be talking about Docker containers and all. Actually I’m not using any of those tools, so I really hope I should be able to post as a separate question and get some help.
In my notebook, I am implementing classification models on a Natural Language Processing task. To this end, I have joined two data frames using the following code;

df_new = pd.merge(left=data_dtm,
              right=data_new,
              how='left',
              left_index=True,
              right_index=True)
df_new.head(4)

Above code produces a data frame of size 177706 x 34K columns, which is a considerable size data frame. Then, I’m running following simple code;

df_new.drop('Filtered Review Text', axis=1, inplace=True)

which is simple column removing comment in pandas. But this gives me the error message that Kernel has died. since I’m new user, hence not allowed to upload images. Here is some info about my environment;

jupyter core     : 4.6.3
jupyter-notebook : 6.0.3
qtconsole        : 4.7.5
ipython          : 7.16.1
ipykernel        : 5.3.0
jupyter client   : 6.1.5
jupyter lab      : 2.1.5
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 5.0.6
traitlets        : 4.3.3

And I am running on macOS Catalina version 10.15.6 , the latest version. For reference, I see following message in the terminal;

KernelRestarter: restarting kernel (1/5), keep random ports
kernel 7f214830-f591-48ef-8310-66bc6c30d9a3 restarted

Can I kindly get some help here, why is it happening? Help is appreciated.

Typical causes for a kernel dying like this are either a segmentation fault, or an out of memory exception. You might be able to configure your host such that you get more information about the crash (memory dumps etc), but I don’t really have any clue about what those settings are.

1 Like

Appreciate your kind response. I will try to look into more resources now.