Last checked
Learn Python for data science in four weeks: week one for variables and loops, week two for lists, dictionaries and functions, week three for reading files, and week four for pandas. Skip classes and decorators for now. Write a small script every weekend, using data you recognise.
McTaba runs coding and data bootcamps in Kenya. This guide is written to be useful whether or not you ever join one.
Picture a shopkeeper in Gikomba with a notebook of daily sales. She does not need the whole of Python. She needs to read numbers, add them, group them and draw a chart. That is the slice this plan teaches.
Where Python sits among the other skills is in our data science career map for Kenya. This page is only the first 30 days.
Use Google Colab. It runs in a browser tab, needs no install and saves your work to Google Drive. All sample data below is made up.
| Days | Topic | You finish with |
|---|---|---|
| 1 to 7 | Variables, numbers, strings, loops | A script that totals a list of payments |
| 8 to 14 | Lists, dictionaries, functions | A function that groups sales by product |
| 15 to 21 | Files and CSV | A script that reads a sales file |
| 22 to 30 | pandas and one chart | A notebook that answers one shop question |
A class makes the pace easier to keep. The Data Science to AI Engineering programme teaches Python from zero in its first two weeks, then moves to data handling. No coding, data or maths background needed.
Start with the official Python tutorial, or any free course you like. The goal for week one is to total a list of numbers with a loop.
Imagine five made-up airtime top-ups, in shillings:
topups = [50, 100, 20, 250, 100]
total = 0
for amount in topups:
total = total + amount
print("Total:", total) # Total: 520
Week two adds dictionaries and functions. A dictionary pairs a name with a number, like a till roll pairs a product with a count.
sales = [("maize flour", 3), ("sugar", 2), ("maize flour", 5)]
def count_by_product(rows):
counts = {}
for product, qty in rows:
counts[product] = counts.get(product, 0) + qty
return counts
print(count_by_product(sales)) # {'maize flour': 8, 'sugar': 2}
Notice what that function does. It is a GROUP BY written by hand. When you meet SQL, the idea will feel familiar. Our guide to SQL for data analysis shows the same grouping in a query.
strip, lower, split and replace, then look up the rest.Get weekly developer tips
Join 25,000+ developers. Practical guides, job tips, and new content — straight to your inbox.
No spam. Unsubscribe anytime.
Real data arrives in a file. Make a small CSV called sales.csv yourself with these made-up rows:
date,product,qty,price
2026-10-01,maize flour,3,150
2026-10-01,sugar,2,180
2026-10-02,maize flour,5,150
2026-10-02,milk,4,60
Now read it and compute the money taken per row.
import csv
with open("sales.csv") as f:
reader = csv.DictReader(f)
for row in reader:
revenue = int(row["qty"]) * int(row["price"])
print(row["date"], row["product"], revenue)
Two habits to start now. First, every cell from a CSV is text, so convert it with int() or float(). Second, print the first rows after every step, so you see what changed.
Messy data is the normal case. Phone numbers appear as 0712..., +254712... and 254712.... Dates arrive as 03/10/2026 and 2026-10-03. Write small functions that fix one thing each.
pandas holds a table in memory and lets you filter, group and add columns in one line each. The same four rows, loaded:
import pandas as pd
df = pd.read_csv("sales.csv", parse_dates=["date"])
df["revenue"] = df["qty"] * df["price"]
by_product = df.groupby("product")["revenue"].sum().sort_values(ascending=False)
print(by_product)
by_product.plot(kind="bar", title="Revenue by product (made-up data)")
That is a table, a group, a sort and a chart in six lines. The pandas project has good beginner pages in its getting started tutorials.
Take a dataset you did not make up. A good place to find one is our list of Kenya open datasets. Answer one question with a table and one chart, then post the notebook on GitHub.
The same 30 days sit inside a longer plan in our six-month data science roadmap for beginners.
After 30 days you can read, clean, group and chart a file. That is real work, but it is a start. Statistics is the next block: see the statistics you actually need for data science.
If you want live classes, weekly projects and feedback, look at the Data Science to AI Engineering programme. It starts on 11 January 2027 and costs KES 140,000, or KES 120,000 if paid in full upfront.
KES 140,000 (KES 120,000 upfront)
Data Science to AI Engineering: 5 months full time or 8 months part time, hybrid in Nairobi. Fraud, credit and M-Pesa data from Week 1, and every model deployed. Starts 11 January 2027.
See the Data Science programme