Set Your Jupyter Notebook up Right with this Extension

You can change the default template in main.

js (see my article on writing a Jupyter Notebook extension for more details on how to write your own).

The default template and imports are relatively plain, but you can customize them to whatever you want.

Default template and importsIf you open an old notebook, you won’t get the default template, but you will be prompted to change the name from Untitled every time you run a cell:The Setup extension will continue prompting until the notebook name is changed from Untitled.

Sometimes, a little bit of persistence is what you need to change your ways.

Parting ThoughtsFrom now on, let’s strive to create better notebooks.

It doesn’t take much extra effort and it pays off greatly as others (and your future self) will be able to learn from your notebooks or use the results to make better decisions.

Here are a few simple rules for writing effective notebooks:Name your notebooks.

Simple but helpful when you have dozens of files.

Add clear yet concise explanations of what your code does, how it works, what are the most important results, and what conclusions were drawn.

I use a standard template for notebooks to encourage the habit.

Run all your cells in order before sharing a notebook and make sure there are no errors.

The Setup extension will not solve all notebook-related problems, but hopefully, the small nudges will encourage you to adopt better habits.

It takes a while to build up best practices, but, once you have them down, they tend to stick.

With a little bit of extra effort, we can make sure that the next talk someone gives about notebooks is: “I like effective Jupyter Notebooks.

”As always, I welcome feedback and constructive criticism.

I can be reached on Twitter @koehrsen_will.

.

. More details

Leave a Reply