pbPassingBI
/
Python basics for data beginner 5 min

Setup and Jupyter notebooks

Getting an environment running and knowing how notebooks actually execute.

What you'll be able to do
  • Install a working environment
  • Run and restart a notebook
  • Avoid the out-of-order execution trap

Installing

The quickest route for analysis work is the Anaconda distribution, which bundles Python, pandas, matplotlib and Jupyter together.

If you already have Python:

pip install pandas matplotlib seaborn jupyter openpyxl

openpyxl is the Excel reader — easy to forget until read_excel fails.

Notebooks

jupyter notebook

A notebook is a sequence of cells. Shift+Enter runs a cell and moves on; Ctrl+Enter runs it and stays. The number in brackets beside a cell shows the order things actually ran in.

The trap worth knowing on day one

Out-of-order execution

Cells share one memory space, and you can run them in any order. A notebook that works on your screen can fail completely for someone running it top to bottom — because you defined something in a cell you later deleted or edited.

Before you trust a result, or share the notebook: Kernel → Restart & Run All. If it does not survive that, it does not work.

A first cell

import pandas as pd
import matplotlib.pyplot as plt

pd.set_option('display.max_columns', 50)
pd.set_option('display.width', 120)

pd and plt are near-universal conventions — use them, because every example you find online assumes them.

Key points
  • Cells share memory and can run in any order
  • Restart & Run All before trusting or sharing a notebook
  • import pandas as pd is the convention everything else assumes
Check yourself