Making Python come alive with Jupyter

I’ll admit something about burgers: I do eat other types of food. One of my favourite desserts is knafa. It’s a noodle type pastry made in many parts of the Middle East. I recently visited Istanbul, and I probably consumed more knafa than I’ve had in total for at least a year. In one of the sweet shops I visited, you could see how the chefs were making knafa, and also how they were cooking it, on top of a charcoal grill. The final step was being put under a special syrup tap. I also opted to have mine served with ice cream, as you can see above (yes, it tasted great, and the one pictured, was by far the best one I ate during my trip). Seeing the process which made the knafa made me appreciate the final product more. Of course, whether I could make knafa quite as good is another question..!

 

When it comes to coding, unless you’re a developer, the code is pretty much hidden, just like the cooking process is to whoever is eating the food. If you want to show what you’ve done in code to clients or to students to teach, I suppose you can just show them code? Maybe use a PowerPoint. However, it can be cumbersome to keep copying and pasting code into PowerPoint. Furthermore, the code is basically static in PowerPoint. Ideally, to teach, you want to work interactivity, changing parameters, re-running to illustrate things.

 

The solution is of course Jupyter! Jupyter notebooks allow you to mix code, text and media like photos. People will be able to see exactly what’s cooking! In a sense it’s like a research paper, which comes alive, because users can easily execute the code. You can also change code and run it live. Jupyter notebooks support many different languages including Python and R. There are also Beaker notebooks, which are similar, but with those you can mix code together from multiple languages in the same notebook (although I haven’t yet used Beaker yet).

 

Jupyter notebooks have been around for a while, although I didn’t really try using them much, because I’ve just been so used to using PowerPoint. It’s only recently, that I started to use Jupyter notebooks, primarily because I’m putting together a Python in finance workshop for a university and will also it in house at financial firms. The great thing with Jupyter notebooks is that the same notebook can be used as slides, with the RISE Jupyter extension. You just specify what parts of the notebook you want to display as a slide, and which to skip (which should just be included as longer form notes) when viewing this way. It becomes a lot easier than copying and pasting into PowerPoint every time you want to change the code!

 

If you haven’t used Jupyter notebooks, I definitely recommend trying them out. For teaching and presenting I’ve found them very useful. The whole process of make research paper, teaching material and slides, really does become quicker and easier with Jupyter notebooks. It also makes it easier for folks to replicate results and see what you’re doing, ideal for teaching!