Hacker News new | ask | show | jobs
by blindriver 712 days ago
Can someone explain their views on Jupyter notebooks? As far as I can tell, the instructor/content creators will set up the "notebook" and students can read the notes and click on the "play" button to see it work in action. Is there anything else besides that?

I guess I'm old school and am used to cutting and pasting and running things in my own terminal, so I'm wondering if there are added benefits that I'm not aware of of Jupyter notebooks. It seems to have a very loyal following so I would love to learn their perspective!

8 comments

I'm a so called "scientific" programmer, meaning that I use programming as a tool for solving problems, not for writing software that others will use. Many of my programs run only once, or a few times with changes each time.

I've switched virtually all of my work to Jupyter, including some lab automation, but also data analysis, modeling, visualization, and so forth. I use it as an interactive lab notebook that can "do" things.

Of all the tools I've used in 40+ years, my Jupyter notebooks are the best thing I've experienced for being able to go back and understand things I've done, weeks or years later.

When I use other editing software such as word processing, I quickly reach a point where I say to myself: "I wish I could just pop a code cell in here."

As a fairly mature technology, Jupyter has a lot of known quirks and shortcomings (I'm talking about you, out-of-order execution and hidden state), but I'm putting up with them because the benefits are huge.

When I learned to program I was working as a scientist. I was relying on OriginLab (a scientific version of Excel) for my data analysis and it was a real pain. I decided to start using python for analysis and plotting and started with scripts and terminal interactivity, but found it too clunky. Jupyter feels more interactive when you are working with data because you need to explore the data and experiment with data manipulation in a way I found quite natural to do in a notebook.

Since then I've moved into software development where I rely on my IDE for any coding that involves working with more than a few modules. And as I got better working with an IDE I did gravitate toward making a script for certain kinds of tasks where I use to reach for a notebook, but there are still many data analysis tasks that I would much prefer a notebook for.

It's also quite nice to share a notebook with someone to show them how you arrived at your conclusions, and it's nice for them to be able to take your analysis and modify it or test their own ideas on top of yours. Obviously the notebooks are not great for collaboration without some fiddling around with git, but they are still very good for this kind of collaboration.

You can also edit the notebook, both code blocks and text. It's used for quick visual iterative exploration of datasets with descriptions. The focus is on creating a report of your analysis and process rather than a "product".
Another point not mentioned by the other comments: you run code interactively (like you would do in a REPL), but keeping what you wrote. This is very practical, for example, if you want to develop a simple code for data analysis. You fetch the data only once, then develop the rest of the code based on it, instead of writing everything without seeing the data.

As a consequence of it, it makes easier to write bad code. I care about code quality, but I must admit that sometimes I needed to stop and refactor my jupyter notebooks.

It's a nice tool, but it doesn't replace writing a .py

I think there is no single answer. Some people hear at a conference that Jupyter is "the thing to use", so they start using it for everything while they would be much better off with .py files.

Some use it because the interface was copied form Mathematica, where it makes much more sense than for Python.

These are the serious users.

There are a lot of non-serious users who have discovered that presenting a mixture of code snippets and text that looks good is enough, certainly for PyCon style talks. These users depend on the tool for their fake careers, so they promote it wherever possible, and the popularity increases even more.

Data science / ML are using that. Databricks (data platform, data warehouse) have support to run notebooks in workflows on periodic basis.

There is market of professional use of them.

Really good for doing some basic data science, the kind of thing where you want some graphs based on some source data that is variable.

Being able to change functions around and generate new graphs (IE; if I want the mean not the median for a contrived example) is really handy.

Imo there hasn't been much of a point except as a share-only format since vscode’s Python extension could natively handle comment-delimited code cells. You get all the benefits of a Jupyter notebook while still just writing a plain text file.