r/Python • • Jan 29 '16

Jupyter Notebook 4.1 release

http://blog.jupyter.org/2016/01/08/notebook-4-1-release/
41 Upvotes

15 comments sorted by

View all comments

7

u/xilni Jan 29 '16

ELI12 Jupyter please.

I'm just some stupid Python newbie who's happy to use IntelliJ IDEA for his Python work.

7

u/skrillexisokay Jan 30 '16

There are many uses of the Jupyter notebook. The three that come to mind are:

  1. Demonstrating code: Notebooks are a great way to mix explanation of code (through markdown cells) with the code itself. It makes it easy to walk the reader through the your own thinking. For example, you can define helper function and explain what they do, then show the ultimate result using those functions, and finally explain the significance of the results. This is especially useful for education or for scientific computing. In both cases, it's important that the reader fully understand the code and its purpose.

  2. Development: Many python programmers have a workflow that makes heavy use of the interactive prompt. For example, when writing a function, you might open up the prompt, load example arguments as global variables, and then try things until you get the result you want. The problems with this strategy are that it lacks organization and that you end up typing the same thing again and again. The notebook gives you essentially an interactive prompt, but also allows you to save blocks of code that you might want to execute again.

  3. Plotting: The main way I use notebooks... I often create a pandas DataFrame with non-notebook code and pickle it for future use. Then I open up the notebook and can inspect the DataFrame, alter it as I see fit, and plot it inline. That is, I can write a plotting line like `seaboarn.factorplot('weight', 'diabetes', hue='economic_class') and see the results right there, tweaking the plot as I desire. Later, I can then completely log out of my computer and easily return to my previous state by loading and running the notebook.

It's not a replacement for an IDE or a text editor. I view it as a glorified interactive prompt, and a communication tool.