22. Exporting and Sharing Your Analysis
22.5 Folder Hygiene: Raw vs Clean vs Outputs
Why. Overwriting data.csv with a cleaned version destroys the audit trail. Festival spikes get blamed on “missing rows” that you dropped. Folders save friendships.
What. A simple layout:
project/
data/
raw/ # never edit by hand
clean/ # outputs of cleaning notebook
notebooks/
figures/ # PNG only
outputs/ # CSV / XLSX for humans and systems
README.md # one paragraph on grain + sources
How.
Hygiene rules
- Copy vendor files into
data/raw/with the original name + date. - Cleaning notebook reads only from
raw/, writes only toclean/. - Analysis notebook reads
clean/, writesoutputs/andfigures/. - Never double-click-edit a CSV in Excel and save over
raw/(Excel can break encoding). - Put
random_stateand filter rules in the notebook top cell.
Worked example A — Paths in code.
from pathlib import Path
ROOT = Path(".")
RAW = ROOT / "data" / "raw" / "blinkit_maha_22-10-2026.csv"
CLEAN = ROOT / "data" / "clean" / "orders_clean.csv"
OUT = ROOT / "outputs"
FIG = ROOT / "figures"
for d in [RAW.parent, CLEAN.parent, OUT, FIG]:
d.mkdir(parents=True, exist_ok=True)
Worked example B — Naming.
| Bad | Better |
|---|---|
final.csv |
orders_clean_2026-10-22.csv |
chart.png |
pune_delivered_gmv_2026-10-22.png |
newnew2.xlsx |
city_status_2026-10-22.xlsx |
Worked example C — README stub.
# Blinkit Maharashtra lab (fictional)
Grain: one row = one order.
Cities: Pune, Solapur, Nashik, Sambhaji Nagar, Kolhapur, Nagpur.
Currency: INR. Dates: dd-mm-yyyy. Timezone: IST.
Raw files are immutable. Clean files are rebuilt from notebooks.
Salman clones the folder months later and still understands it.