Jupyter Notebooks#
What are Jupyter Notebooks?#
Jupyter Notebooks (.ipynb files) are interactive documents that combine code, text, and visualizations. They are the standard format for data analysis in Python and are used throughout this book.
Each notebook consists of cells:
Code cells — contain Python code that can be executed
Markdown cells — contain formatted text, headings, lists, images, and equations
Using Google Colab#
Google Colab is a free, cloud-based Jupyter environment — no local installation required.
Opening notebooks from this book in Colab:
The notebooks in this book can be opened directly in Google Colab. A rocket icon () appears in the top toolbar — click it and select Colab to open the notebook there.
Hello World in Colab#
To get started, open a new notebook in Google Colab and try the following.
1. Code Cell — Click on the first cell (or press + Code) and type the following code. Press Shift+Enter to run the cell. The output Hello World! appears directly below the cell.
print("Hello World!")
Hello World!
2. Markdown Cell — Click + Text to add a text cell. Markdown cells support formatted text using Markdown syntax:
# My First Notebook
This is a **Markdown cell**. You can write:
- **Bold** and *italic* text
- Bullet lists
- [Links](https://colab.research.google.com/)
- Mathematical equations: $E = mc^2$
- Tables, images, and more
Press Shift+Enter to render the Markdown cell into formatted text. Double-click the cell to edit it again.
Tip
A typical notebook alternates between Markdown cells (explaining what and why) and Code cells (showing how). This combination of narrative and code is what makes notebooks so effective for data analysis.
Tip
For working with notebooks locally in VS Code or JupyterLab, see the Python Installation & IDE Setup appendix.