惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
IT之家
IT之家
Hugging Face - Blog
Hugging Face - Blog
Engineering at Meta
Engineering at Meta
爱范儿
爱范儿
博客园 - Franky
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
雷峰网
雷峰网
月光博客
月光博客
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
N
Netflix TechBlog - Medium
WordPress大学
WordPress大学
罗磊的独立博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Y
Y Combinator Blog
Know Your Adversary
Know Your Adversary
宝玉的分享
宝玉的分享
L
Lohrmann on Cybersecurity
S
SegmentFault 最新的问题
L
LangChain Blog
K
Kaspersky official blog
P
Palo Alto Networks Blog
P
Privacy & Cybersecurity Law Blog
美团技术团队
Scott Helme
Scott Helme
B
Blog RSS Feed
T
Threat Research - Cisco Blogs
博客园_首页
L
LINUX DO - 热门话题
腾讯CDC
C
CERT Recently Published Vulnerability Notes
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
V
V2EX
Martin Fowler
Martin Fowler
T
The Exploit Database - CXSecurity.com
人人都是产品经理
人人都是产品经理
MongoDB | Blog
MongoDB | Blog
Latest news
Latest news
S
Schneier on Security
AWS News Blog
AWS News Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Jupyter Notebooks: Where Data Science Actually Happens
Akhilesh · 2026-05-03 · via DEV Community

Open any data science tutorial online.

Not a Python script. Not a GitHub repo. A tutorial with explanation, code, output, visualizations, and commentary all woven together in one document.

That document is a Jupyter Notebook.

The best ML papers show their experiments in notebooks. Kaggle grandmasters share their approach in notebooks. Every data science course teaches in notebooks. When you get a data science job, your analysis will probably live in a notebook before it becomes a production script.

Learning Jupyter is not optional. It is the environment where the real work happens.


What Jupyter Actually Is

A Jupyter Notebook is a document that contains a mix of live code, formatted text, equations, and visualizations. You run individual cells instead of entire scripts. Each cell's output appears immediately below it.

The killer feature is this: you can run cell 1, see the output, think about it, then write and run cell 2 based on what you learned. Analysis becomes interactive and iterative instead of run-the-whole-script-and-scroll-through-output.

The second killer feature: the document tells a story. Code plus explanation plus output plus charts, all in sequence, all in one file you can share.


Installation and Launch

pip install jupyter notebook

Enter fullscreen mode Exit fullscreen mode

Launch from your project directory:

jupyter notebook

Enter fullscreen mode Exit fullscreen mode

Your browser opens automatically at http://localhost:8888. You see a file browser. Click "New" → "Python 3 (ipykernel)" to create a new notebook.

Or install JupyterLab, the more modern interface:

pip install jupyterlab
jupyter lab

Enter fullscreen mode Exit fullscreen mode

JupyterLab looks like an IDE with a file browser on the left, multiple tabs, and a cleaner interface. Either works. JupyterLab is preferred for serious work.


Anatomy of a Notebook

Every notebook is made of cells. Three types.

Code cells run Python (or R, Julia, SQL if configured). Output appears immediately below.

Markdown cells render formatted text. Headers, bold, italics, bullet lists, links, equations. These are where you explain what your code does and what your findings mean.

Raw cells contain unformatted text that Jupyter leaves alone. Used rarely.

The mode toggle in the top toolbar switches between cell types. Or press M to convert to Markdown, Y to convert back to code.


Essential Keyboard Shortcuts

Jupyter has two modes. Edit mode is when you are typing inside a cell. Command mode is when no cell is being edited. Press Escape to enter command mode. Press Enter to enter edit mode.

In command mode:

A          → insert cell Above
B          → insert cell Below
D D        → delete cell (press D twice)
M          → convert to Markdown
Y          → convert to Code
Z          → undo cell deletion
Shift + M  → merge selected cells

Enter fullscreen mode Exit fullscreen mode

In edit mode:

Shift + Enter    → run cell, move to next
Ctrl + Enter     → run cell, stay on it
Alt + Enter      → run cell, insert new below
Tab              → autocomplete
Shift + Tab      → show function signature/docstring
Ctrl + /         → comment/uncomment line

Enter fullscreen mode Exit fullscreen mode

Learn these. Reaching for the mouse to run cells is slow. Keyboard-driven Jupyter is fast.


Your First Real Notebook

Here is how a data analysis notebook actually looks. Every section has a purpose.

# Titanic Survival Analysis

**Dataset:** Titanic passenger data, 891 rows  
**Question:** Which factors most strongly predicted survival?  
**Author:** Your Name | Date: 2024-03-01

Enter fullscreen mode Exit fullscreen mode

# Cell 1: Imports - always first
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

sns.set_theme(style="darkgrid")
print("Libraries loaded")

Enter fullscreen mode Exit fullscreen mode

Output:

Libraries loaded

Enter fullscreen mode Exit fullscreen mode

## 1. Load and Inspect Data

Enter fullscreen mode Exit fullscreen mode

# Cell 2: Load
df = pd.read_csv("titanic.csv")
print(f"Shape: {df.shape}")
df.head()

Enter fullscreen mode Exit fullscreen mode

# Cell 3: Missing values
df.isnull().sum()[df.isnull().sum() > 0]

Enter fullscreen mode Exit fullscreen mode

**Findings:** Age is missing 177 values (19.9%). Cabin is missing 687 (77%).
We will impute age with median and drop Cabin.

Enter fullscreen mode Exit fullscreen mode

# Cell 4: Clean
df["Age"] = df["Age"].fillna(df["Age"].median())
df = df.drop(columns=["Cabin"])
print("Cleaning done. Missing values:", df.isnull().sum().sum())

Enter fullscreen mode Exit fullscreen mode

## 2. Survival by Gender

Enter fullscreen mode Exit fullscreen mode

# Cell 5: Gender analysis
survival_by_sex = df.groupby("Sex")["Survived"].mean() * 100
print(survival_by_sex.round(1))

fig, ax = plt.subplots(figsize=(7, 4))
survival_by_sex.plot(kind="bar", color=["coral", "steelblue"], ax=ax)
ax.set_title("Survival Rate by Gender")
ax.set_ylabel("Survival Rate (%)")
ax.set_xlabel("")
ax.tick_params(axis="x", rotation=0)
plt.tight_layout()
plt.show()

Enter fullscreen mode Exit fullscreen mode

This is what a proper notebook looks like. Markdown explains the context. Code does the work. Output shows the result. Markdown interprets the finding. The reader follows your thinking, not just your code.


The Variable State Problem

This is the most important thing to understand about Jupyter.

The kernel maintains state between cells. Every variable you define stays in memory until you restart the kernel or explicitly delete it. This creates a trap.

# Cell 1: Run this
x = 10
print(x)

# Cell 2: Run this
x = 20
print(x)

# Cell 3: Go back and run Cell 1 again
# x is now 20 in memory even though Cell 1 says x = 10
# The cell shows output of 10 but x in memory is actually... undefined until you run it
# Then x becomes 10 again
# Cell 2's x = 20 is gone from memory but the output still shows 20

Enter fullscreen mode Exit fullscreen mode

This causes subtle bugs. Your notebook can show outputs that no longer match the current state of the variables. The number next to each cell shows execution order. [1], [2], [3] in sequence is safe. [3], [1], [2] means cells ran out of order and state may be inconsistent.

The fix: Kernel → Restart and Run All before sharing any notebook. This resets all variables and reruns every cell in order from top to bottom. If the notebook fails, it has a bug. A notebook that only works when cells are run in a specific manual order is broken.


Magic Commands

Jupyter has magic commands that extend Python with useful utilities.

%time df.groupby("Sex")["Survived"].mean()

Enter fullscreen mode Exit fullscreen mode

Times a single expression.

%%timeit
result = df.groupby(["Sex", "Pclass"])["Survived"].mean()

Enter fullscreen mode Exit fullscreen mode

Times an entire cell repeatedly and reports average.

%matplotlib inline

Enter fullscreen mode Exit fullscreen mode

Makes matplotlib plots appear inline inside the notebook instead of in a popup window. Usually set once at the top.

%who

Enter fullscreen mode Exit fullscreen mode

Lists all variables currently in memory.

%run script.py

Enter fullscreen mode Exit fullscreen mode

Runs an external Python script and makes its variables available in the notebook.

%%bash
ls -la
git log --oneline -5

Enter fullscreen mode Exit fullscreen mode

Runs the cell contents as shell commands. Incredibly useful for running terminal commands without leaving the notebook.

?pd.DataFrame.groupby

Enter fullscreen mode Exit fullscreen mode

Shows documentation for any function. Double question mark ?? shows the source code.


Organizing a Professional Notebook

Structure every notebook the same way. Consistency makes notebooks readable and maintainable.

1. Title and description (Markdown)
2. Imports (single code cell, all imports together)
3. Configuration and constants (file paths, parameters)
4. Data loading
5. Data inspection
6. Data cleaning
7. Exploratory analysis (multiple sections)
8. Modeling or main analysis
9. Results and interpretation
10. Conclusions (Markdown summary)

Enter fullscreen mode Exit fullscreen mode

Each section starts with a Markdown header. Code cells within a section do one thing. If a code cell is doing five different things, split it.

Keep cells short. A 50-line code cell should be three cells. Short cells are easier to debug because when an error occurs you know exactly which part failed.


Exporting Notebooks

jupyter nbconvert --to html notebook.ipynb
jupyter nbconvert --to pdf notebook.ipynb
jupyter nbconvert --to script notebook.ipynb
jupyter nbconvert --to markdown notebook.ipynb

Enter fullscreen mode Exit fullscreen mode

HTML export produces a self-contained file you can email or post online. PDF requires LaTeX. Script converts to a .py file, removing markdown and keeping only code.

For sharing analysis with non-technical stakeholders, HTML export is ideal. They see the full notebook, code included or hidden, in any browser.


nbstripout: Clean Notebooks Before Committing

Never commit notebooks with output to Git. Output can contain sensitive data, large images, or paths specific to your machine. It also creates enormous diffs that obscure what actually changed.

pip install nbstripout
nbstripout --install

Enter fullscreen mode Exit fullscreen mode

After installation, nbstripout automatically strips output from notebooks before every git commit. Your colleagues get clean notebooks with no output. When they open the notebook and run it, they generate their own output.

This is a professional habit. Install it on every machine you use.


Notebook Extensions Worth Installing

pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user

Enter fullscreen mode Exit fullscreen mode

Then open the Nbextensions tab in Jupyter. Useful ones to enable:

Table of Contents (2): generates a clickable table of contents from markdown headers. Essential for long notebooks.

ExecuteTime: shows how long each cell took to run.

Collapsible Headings: lets you collapse sections to focus on what you are working on.

Variable Inspector: shows all current variables, their types, and values. Like a live spreadsheet of your memory state.


Jupyter vs Scripts: When to Use Each

Use a notebook when: exploring new data, prototyping analysis, presenting findings, teaching a concept, writing a report with code embedded.

Use a Python script when: building a reusable module, running scheduled jobs, deploying to production, writing code that will be imported by other code.

The workflow is: explore and prototype in a notebook, extract clean reusable functions into scripts, import those scripts in future notebooks. The notebook is the thinking environment. The script is the production code.


A Resource Worth Knowing

Jake VanderPlas wrote the entire Python Data Science Handbook as a series of Jupyter Notebooks, available free at github.com/jakevdp/PythonDataScienceHandbook. Every concept taught through interactive notebooks you can clone and run. The notebooks on NumPy, Pandas, Matplotlib, and scikit-learn are the best introductory material on those libraries that exists. His approach to structuring analysis notebooks has influenced how thousands of practitioners work.

Search "Jake VanderPlas Python Data Science Handbook" and the GitHub repo comes right up.


Try This

Create a Jupyter notebook called titanic_analysis.ipynb.

It must have all of the following:

A proper title cell in Markdown with your name and the date.

All imports in a single cell at the top.

At least five section headers using Markdown ##.

Between each code section, a Markdown cell that explains what you found and what you will do next.

Code that loads the Titanic dataset, cleans it, and produces at least four visualizations: survival by gender, survival by class, age distribution by survival status, fare distribution with a reference line at the median.

A conclusions section in Markdown at the bottom summarizing three specific findings from your analysis.

Before sharing, run Kernel → Restart and Run All. Fix any errors until it runs clean from top to bottom.

Export it as HTML. Open the HTML in your browser. That is what anyone you share it with will see.


What's Next

Jupyter runs locally. Google Colab runs in the cloud and gives you free GPU access. For everything in this series that requires serious compute, training neural networks, running large experiments, Colab is where it happens. That is the last post in Phase 5.

After that, Phase 6 starts. Machine learning. The thing this whole series has been building toward.