DEV Community

Cover image for Jupyter Notebooks are The Business
Ryan Palo
Ryan Palo

Posted on • Updated on • Originally published at assertnotmagic.com

Jupyter Notebooks are The Business

So this is about one of those things that I knew existed, but I kind of thought "Oh, this is just for scientists and data people to do science and data things." And then I used it to write interactive code snippets for a lecture (that I hope to give some day) and now my mind is blown and I'm probably going to write all of my blog posts this way from now on. So without further ado:

Jupyter Notebooks

You may know about these. If you're a data scientist or have done some amount of Python you may have seen these, and you may know it by its previous name: IPython Notebooks. For those of you who don't know, it looks like this.

first look at Jupyter Notebook

It's awesome. It has individual cells that can be code or markdown. The code cells run independently, but in the same namespace, so you can carry variables and data from one cell to the next. You can do something like this:

notebook cell demonstration

Note how the cells will output the last evaluation without a print statement required, just like a REPL. Here are some other cool things.

Pretty Data Output

If you are working with a lot of data, notebooks will inline pretty table and chart outputs.

different cell outputs

Internal Links

This:

Raw table of contents

Renders to this:

Rendered table of contents

And the internal links work!

No More Cleanup Scripts

Again, if you're working with data, you don't have to have a separate script to clean the data and re-output it into a csv (or whatever). Each cell remembers its state, so you can run the cell at the top that takes forever to clean the data once and then re-run and re-modify the cells below without having to rerun the cleaning cell.

Lots of Inputs and Outputs

While I found out about it through Python -- and I think initially it only supported Python -- the community now provides about a billion different kernels you can run. See the full list here.

For my purposes, I like that it outputs directly to markdown for blog posts, but it also outputs into Python files, ReSTructured text, LaTex, PDF, and HTML!

More

I also just discovered something called nbgrader that is essentially an assignment/automated grading framework for Jupyter Notebooks. I haven't used it yet, but it looks like the things that dreams are made of. There's also support for converting a notebook into a html slideshow. This plugin allows for a powerpoint-like feel while still being able to execute cells, for prestructured quasi-live-coding demos. Honestly, as I keep finding these features, I keep getting more and more excited.

I'm really interested in seeing if I could use this even more in a classroom setting. If you are using Notebooks in the classroom, let me know about it! Also, let me know all about everything you do for teaching because teaching coding in the classroom is currently my dream goal.

Long story short, Jupyter Notebooks are The Business. Get them today.

Top comments (8)

Collapse
 
tingenek profile image
Mark Lawson

My favourite feature right now are "cell magics" - great for dropping in a bit of #bash or R in an otherwise Python'esque notebook or spinning up a Graphviz dot diagram. Oh, and ipywidgets for a bit of interactivity.

Collapse
 
walker profile image
Walker Harrison

Discovered Jupyter notebooks about 6 months ago. One of those things that once you start using them, you can't fathom how you lived without them before. Did I just run entire .py scripts over and over again??

Collapse
 
ackvf profile image
Vítězslav Ackermann Ferko

Oh I want something like this with JavaScript!

Collapse
 
rpalo profile image
Ryan Palo

There are actually a ton of different kernels that you can run inside Jupyter notebooks, including a NodeJS and TypeScript one! Check out the master list. There should be docs there for installing the extra kernel, but I remember trying it with Ruby, and it's pretty easy.

Collapse
 
dhanush_ramuk profile image
dhanush 

I just started to work with jupyter notebook, and I'm finding myself working with it more than other editors or IDLE.

Collapse
 
justinhaef profile image
Justin Haefner

Did you see that Azure is offering a Notebooks service? If you had remote students I'm thinking you could leverage that pretty well.

Collapse
 
ash_hathaway profile image
Ash Hathaway 💁

I totally downloaded Jupyter after reading this. Thanks for sharing!

Collapse
 
ben profile image
Ben Halpern

I have to say, from what I've seen of Jupyter notebooks, they are one of the great examples of UX+code in order to allow the user to be maximally productive and creative.