Skip to content

What is the Main Purpose of Jupyter Notebook?

Purpose

I was learning Python data visualization with Matplotlib when I kept seeing references to Jupyter Notebook. Everyone said “use Jupyter for data science,” but I couldn’t understand why. I had VS Code set up perfectly - why would I switch?

This post explains what Jupyter Notebook is actually for and when you should use it instead of a traditional IDE.

What is Jupyter Notebook?

Jupyter Notebook is an interactive computing environment that lets you run code in small chunks called “cells” and see results immediately. Unlike traditional Python scripts where you run the entire file at once, Jupyter lets you execute code piece by piece.

The main purpose is interactive exploration - you can experiment with data, try different visualizations, and see feedback instantly without re-running your entire script.

Traditional IDE vs. Jupyter Notebook

When I work in VS Code or PyCharm with Matplotlib, the workflow looks like this:

Write code → Run entire script → See plot in separate window
↑ ↓
└─────── Make changes → Close window → Run again

Every time I want to try a different chart type or styling option, I have to:

  1. Modify the code
  2. Save the file
  3. Run the entire script
  4. Close the previous plot window
  5. Look at the new plot
  6. Repeat

This gets tedious fast when you’re experimenting.

In Jupyter Notebook, the workflow is different:

Write cell → Run cell → See plot immediately below
↑ ↓
└── Tweak cell → Run again ──┘

The plot appears right under your code cell. You can scroll up and down to compare different attempts. Each cell is independent - you can run just one cell without re-running your entire notebook.

Why Use Jupyter for Data Visualization?

Here’s a concrete example. When I’m working with sales data and want to explore different chart styles:

In a traditional Python script, I’d write:

analysis.py
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv('sales.csv')
df.head()
# Try bar chart
df.plot(kind='bar')
plt.show()
# Oops, I want to try line chart instead
# Have to comment out the bar chart code
# df.plot(kind='bar')
# plt.show()
df.plot(kind='line')
plt.show()
# Now I want to add styling
plt.style.use('seaborn')
df.plot(kind='line')
plt.show()

Every time I add a new chart, I have to comment out the old ones, or all three plots will appear in separate windows when I run the script.

In Jupyter Notebook, I just create separate cells:

Cell 1
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv('sales.csv')
df.head()
Cell 2 - Bar chart
df.plot(kind='bar')
Cell 3 - Line chart
df.plot(kind='line')
Cell 4 - Styled line chart
plt.style.use('seaborn')
df.plot(kind='line')

Each cell shows its output right below the code. I can see all four attempts at once - the data preview, the bar chart, the plain line chart, and the styled version. No need to comment out code. No separate windows popping up.

Cell-Based Execution

The key feature that makes Jupyter different is cell-based execution. You’re not running a monolithic script - you’re running small, independent code blocks.

This matters because:

  1. You don’t need print statements - In a Python script, you need print(df.head()) to see your data. In Jupyter, just typing df.head() in a cell displays the output automatically.

  2. Load data once - When you load a dataset in one cell, it stays in memory for all other cells. You don’t need to reload it every time you want to try a new visualization.

  3. Iterate quickly - You can tweak one cell and re-run just that cell. The data loaded in earlier cells stays in memory.

  4. Document your thinking - Jupyter supports markdown cells, so you can add explanations between your code cells. You’re literally writing a document with executable code embedded in it.

When Should You Use Jupyter Notebook?

Use Jupyter for:

  • Data exploration with pandas, NumPy
  • Data visualization with Matplotlib, Seaborn, Plotly
  • Machine learning prototyping with scikit-learn
  • Scientific research and analysis
  • Teaching and learning Python concepts
  • Quick data investigations and experiments

Use traditional IDEs (VS Code, PyCharm) for:

  • Building production applications
  • Web development with Django, Flask
  • Automation scripts
  • Large software systems with multiple modules
  • Anything that gets deployed to users

Real-World Workflow Example

Here’s how a typical data analysis session looks in Jupyter:

Cell 1: Import libraries
Cell 2: Load data
Cell 3: Check data shape and types
Cell 4: Look for missing values
Cell 5: Create histogram ← See plot immediately
Cell 6: Filter data to remove outliers
Cell 7: Create new histogram ← Compare with Cell 5
Cell 8: Add markdown notes about what you found
Cell 9: Calculate correlations
Cell 10: Create scatter plot matrix
Cell 11: Add more markdown with conclusions

You can see the entire analysis story as you scroll through the notebook - code, visualizations, and explanations all in one place.

Why Data Scientists Love Jupyter

Beyond the cell-based execution, Jupyter has benefits specific to data science work:

Inline visualization: Plots appear below the code that created them. This creates a direct visual connection between your code and the output. In traditional IDEs, plots open in separate windows, breaking that connection.

Literate programming: You can mix markdown explanations with code. This lets you create a narrative around your analysis - explaining what you’re doing and why, not just showing code.

Reproducible research: Your notebook captures the entire analysis workflow - data loading, cleaning, exploration, and visualization. Someone else can open your notebook and run it top-to-bottom to reproduce your results.

No boilerplate: You don’t need to write functions or structure your code perfectly. Just explore. Once you figure out what works, then you can refactor it into clean code.

Shareable results: Notebooks can be exported to HTML, PDF, or slides. You can share your analysis with non-programmers - they see the narrative and visualizations without needing to understand the code.

Common Misconceptions

“Jupyter is only for Python”

Actually, Jupyter supports over 100 programming languages including R, Julia, Scala, and JavaScript. The name “Jupyter” comes from the three core languages it was designed for: Julia, Python, and R.

“Professional data scientists don’t use Jupyter”

They do. Jupyter is the standard tool for exploratory data analysis and research in data science. However, once the exploration is done and it’s time to build production systems, the code gets refactored into proper Python modules and deployed with traditional IDE tools.

“Jupyter is just for learning”

It’s used extensively in industry. Data scientists at major companies use Jupyter for:

  • Exploratory data analysis
  • Experimenting with machine learning models
  • Creating reports for stakeholders
  • Prototyping data pipelines
  • Collaborating with team members

“You can’t use Jupyter for large projects”

You can, but you probably shouldn’t. Jupyter excels at exploration and prototyping, not production software. The typical workflow is:

  1. Explore and prototype in Jupyter
  2. Once you know what works, extract the code into Python modules
  3. Build and test the production system in a traditional IDE
  4. Deploy the production system

Getting Started

If you want to try Jupyter Notebook, you have two easy options:

Option 1: Install Anaconda

  • Download the Anaconda distribution
  • It includes Python, Jupyter, and popular data science libraries (pandas, NumPy, Matplotlib)
  • Install once, everything works together

Option 2: Use Google Colab

  • No installation required
  • Runs in your browser
  • Free access to computing resources
  • Your notebooks save to Google Drive
  • Just go to colab.research.google.com and start coding

Summary

In this post, I explained that the main purpose of Jupyter Notebook is interactive computing through cell-based execution. The key points are:

  • Jupyter lets you run code in small chunks and see results immediately
  • It’s perfect for data exploration and visualization - you can iterate quickly without re-running entire scripts
  • Use Jupyter for experimentation and exploration, traditional IDEs for building production applications
  • It combines code, visualizations, and explanations in one document
  • Professional data scientists use Jupyter extensively for exploratory work

If you’re working with Matplotlib or pandas and tired of running entire scripts just to see one changed plot, try Jupyter Notebook. The difference in workflow is immediate.

Final Words + More Resources

My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments