Watch the video first to see Jupyter Notebook in action, then read on for the detail and context.
What Jupyter Notebook is and why finance teams use it
Jupyter Notebook is an interactive Python environment where you write code, see the output immediately, and add plain language notes all in one document. For finance practitioners, this is more than a learning tool. It is a working tool for testing calculations, documenting assumptions, and creating an auditable record of your analysis.
In treasury, risk, and regulatory reporting, you often need to prove what you did, why you did it, and what the numbers mean. A spreadsheet does the calculation but hides the logic. A Python script runs the code but does not show your reasoning. A Jupyter Notebook does both. You write the formula, explain the assumption, run the code, see the result, and anyone reading it later understands the chain of thought.
Many banks use Jupyter for liquidity analysis, interest rate risk calculations, and submissions to regulators. It sits between a sandbox where you learn and experiment, and a production system where you run scheduled jobs. Once you have tested a calculation in Jupyter and documented it, you can move the logic into a script or hand it to a colleague with confidence.
Jupyter Notebook is called "Jupyter" because it originally supported Julia, Python, and R. The name is a pun on the planets in our solar system. You will use it for Python.
Opening and navigating Jupyter Notebook
If you followed the setup guide in install Python and set up your environment, you already have Jupyter installed. Open it by typing this in your terminal or command prompt:
jupyter notebook
Press Enter. Your browser will open, usually at http://localhost:8888. This is a local web server running on your machine. You are not uploading anything to the internet. It is safe and private.
You will see a file browser. This shows the folders and files in the directory where you started Jupyter. On the right side, there is a dropdown labelled "New". Click it and select "Python 3". A new blank notebook opens in a new tab.
The notebook has a toolbar at the top with buttons for Save, Add Cell, Cut, Copy, Paste, Run, and others. Below that is a cell. This is where you work.
Keep Jupyter running in one terminal tab and use another tab for other work. When you are done, go back to the terminal, hold Ctrl and press C, and confirm to shut it down.
Code cells: where your Python runs
A code cell is a block where you write Python. Type this:
x = 5
y = 10
print(x + y)
To run the cell, hold Ctrl and press Enter on Windows or Linux, or hold Cmd and press Enter on Mac. The code executes and the output appears below the cell.
15
Notice that Jupyter numbered the cell as In [1]. When you run another cell, it becomes In [2], and so on. This number tells you the order in which cells were run, not the order in the notebook. This matters when you are experimenting. You might run a cell at the bottom, change a value at the top, and run the bottom cell again. The logic flow is not always top to bottom.
Each cell has its own memory while the notebook is open. If you define a variable in cell 1 and run it, cell 2 can use that variable, even if cell 1 is not visible. This is powerful for testing but also a source of confusion. You might think a variable is defined, but you forgot to run the cell that creates it.
Type this in a new cell:
z = x + y + 100
print(z)
Run it. It works because x and y are still in memory from the first cell. If you close the notebook and reopen it, they will not be. You must run all the cells that define variables before you use them.
For finance work, this matters. If you are testing a liquidity calculation, you might have one cell that loads data, another that cleans it, another that runs the formula. If you skip the first two and run the third, it will fail. Always check that you have run all your setup cells first.
Text cells: documenting your logic and assumptions
Click "Insert" then "Cell Below" to add a new cell. By default it is a code cell. To change it to a text cell, look at the dropdown in the toolbar that says "Code" and click it. Select "Markdown".
Now type:
## Liquidity Calculation
We are calculating the 10 day rolling average of our cash outflows.
**Assumption:** All outflows are realised on their contractual date.
A weekly note on treasury, liquidity and practical Python. No spam, unsubscribe any time.
Press Ctrl and Enter. The text is formatted. ## becomes a heading. **text** becomes bold. This is Markdown, a simple plain language formatting system.
For a regulatory submission or a handover to a colleague, Markdown lets you explain your calculation without leaving the notebook. You can document your data sources, your assumptions, your formulas, and any known limitations. When the regulator or your successor asks why you did something, you have the answer in the same file.
Write this in a new Markdown cell:
**Key assumptions:**
- Inflows from loans are on time
- Outflows from deposits increase by 5% in a stress scenario
- FX conversion happens at today's spot rate
You can also write actual formulas in Markdown using LaTeX. This is optional, but useful for complex calculations. For example:
$$LCR = \frac{HQLA}{Total Cash Outflows_{30}}$$
This renders as a proper mathematical formula in the notebook. Many teams skip LaTeX for simple work, but it is there if you need it.
Running cells and working interactively
The interactive nature of Jupyter is where it shines for learning and experimentation. You can run cells one at a time, change a value, and run again.
Create three cells like this:
Cell 1 (Code):
rate = 0.05
Cell 2 (Code):
principal = 100000
interest = principal * rate
print(f"Interest earned: {interest}")
Cell 3 (Code):
print(f"Total: {principal + interest}")
Run all three in order. You get:
Interest earned: 5000.0
Total: 105000.0
Now click on Cell 1 again. Change the rate to 0.03. Run it. Now run Cell 2 and Cell 3 again. The calculations update. You do not need to rewrite anything. You just changed one value and ran the dependent cells again.
This is how you experiment. You change an assumption, run the analysis again, and see the impact. For IRRBB analysis, you might change the yield curve by 50 bps and see how your net interest income moves. For liquidity, you might stress outflows and see your coverage ratio decline.
But here is a trap: if you run cells out of order, or forget to run a setup cell, your numbers might be wrong and you will not know. Always be aware of which cells you have run and in what order. A good practice is to go to the top of your notebook and select "Run All" in the Cell menu before you use any outputs. This makes sure every cell runs from the top in order.
Organising notebooks for your work and your team
A single notebook can grow large and become hard to follow. Good organisation saves time and prevents mistakes.
One notebook per analysis. If you are doing a daily liquidity report, one notebook for that. If you are building an ICAAP capital model, a separate notebook. This keeps related code and assumptions together.
Use headings to break sections. Your first Markdown cell should explain what the notebook does, who owns it, and when it was last updated.
# Daily Liquidity Analysis
**Owner:** Treasury Team
**Last Updated:** 15 Jan 2025
**Purpose:** Calculate LCR and NSFR for regulatory submission
This notebook loads position data from the core banking system,
applies haircuts according to PRA guidance, and calculates
regulatory liquidity metrics.
Then break the notebook into logical sections: Data Load, Data Cleaning, Assumptions and Parameters, Main Calculation, Output and Validation.
Keep notebooks together in folders. If you have five notebooks for regulatory reporting, put them in a folder called regulatory_reporting. Within that, create subfolders for each report type. Your colleague can then find the notebook they need without asking.
Use descriptive filenames. Call it daily_lcr_calculation_2025.ipynb, not notebook1.ipynb. The .ipynb extension is Jupyter's format.
Add a changelog at the bottom. As you fix bugs or add features, note what changed and when. In six months, you will thank yourself.
From notebook to production: when to move beyond Jupyter
Jupyter is not a replacement for production code. Once you have tested a calculation and you are confident it works, you have two paths.
Path 1: Keep it in Jupyter but automate it. You can use a tool like Papermill to run a notebook on a schedule, feed it fresh data each day, and save the output. This is common in banks for daily reporting.
Path 2: Move the logic to a Python file. Once you know exactly what the code should do, extract it into a .py file, add error handling, and integrate it with your data pipeline. This is better for work of high criticality where speed and reliability matter.
For treasury reporting, you might prototype in Jupyter, move to a script, and run it automatically every morning. For ad hoc analysis or one time submissions, Jupyter is often the final form.
Do not keep production analysis in Jupyter if it runs on a schedule. Notebooks are meant for interactivity. Scripts are more reliable and easier to test and monitor.
Your next steps
You now know how to open Jupyter, write code cells, add text cells, and run them interactively. This is enough to start working.
Your next move is to load some data and do a real calculation. In reading a liquidity position with pandas, we will load a cash flow file into Jupyter and analyse it. You will use what you learned today to combine code, output, and explanation into a working analysis.
Keep your notebooks close to your data. Organise them by project. Add notes as you go. A notebook that is clear to you now will be clear to a colleague or to yourself in six months because you documented your reasoning alongside the code.
This is how Jupyter becomes not just a learning tool, but a tool for real finance work.
Get the next one in your inbox
A weekly note on treasury, liquidity and practical Python. No spam, unsubscribe any time.
Practitioner notes on treasury, liquidity, regulatory reporting and practical Python.
