Hi. In this video we will learn how to work with kernels.
We can interrupt the kernel, uh,
when you are stuck in some long-running calculation. First thing,
what you will do is to try to interrupt the kernel.
We can do it with ii shortcut or directly from the ui. Uh,
when you interrupt the kernel, uh, the objects, uh, that you created, uh,
in the notebook will be preserved. Let's run an example.
Now our code will slip just for 20 seconds,
and when you interrupt the kernel, this will happen
in some situations. Uh, you want to restart the kernel when you,
for example, make some changes in the system.
After installation of some packages, uh,
when interrupting the kernel doesn't help. Uh,
when you restart the kernel, all variables will be lost,
basically be killed. The python process, which was running the notebook.
After that, we have to rerun whole notebook.
If you want to continue to use each objects like data frames, variables,
and so on. So when you have code,
which requires, uh, long running calculations,
best practice is to store the objects to disk.
You can use the pick library for this.
We can do it directly from the UI or with the, uh,
zero zero shortcut.
Another thing, but you can do is to change the kernel of the notebook. Uh,
but we will not do this very frequently.
In our next video,
we will learn how to use kernel from other environment.