DEV Community

Jesper Dramsch
Jesper Dramsch

Posted on • Originally published at dramsch.net on

3 Ways you can use Jupyter Notebook as an excellent Communication Tool

People love to hate Jupyter Notebooks!

They're missing out on a great communication tool.

Here's how data scientists and machine learners can

build great Jupyter Notebooks that people love to read

🧮 Fix your dang code

You can make a mess in notebooks when experimenting.

  1. All Imports into Cell 1
  2. Extract some functions and classes
  3. Comments.
  4. Fix your variable names
  5. Fix the order and outputs
  6. Use black to standardize your code format

✒️ Jupyter has Markdown Cells!

Use them.

If you're not using Markdown in your Notebooks, you should not be using Notebooks.

Write some prose to explain your code.

Whether analysis or model, do yourself a favour and document it.

In case you need a markdown guide.

🔂 Final checks

We all do it.

We forget to run a cell and wonder for an embarrassing amount of time, why we have an error in the next one.

Before you share your notebook:

  1. Restart Kernel to forget all variables
  2. Run All Cells

Not by hand. Automatic.

It'll show any mix ups

🏆 Extra Credit

🦾 Use nbconvert to run all cells from the command line

🧠 Write a utils file with reusable functions

⌨ Learn keyboard shortcuts for efficiency

🎨 Make it interactive with ipykernel

Conclusion

  • Care about code quality
  • Use markdown cells (More than just headings)
  • Make sure the notebook runs
  • Use extra tools to make your life easier

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay