Mctaba Labs logo
BootcampThe WhiteboardProjectsEventsMasterclassesWebinarsLearn
Book CallApply

500+ developers already in the community

Get answers, find accountability partners, and stay ahead

Join Discord →
Mctaba Labs logo

Educating 1 million students in tech by 2030.

Programs

  • Coding Bootcamp in Nairobi
  • Software Engineering Bootcamp
  • Data Science to AI Engineering
  • HighSchool Graduates Launchpad
  • AI & Business Automation
  • Corporate Training
  • Kids & Teens
  • McTaba Story & Mission
  • Full-Stack Curriculum
  • Course Pricing & Plans
  • Frequently Asked Questions

Resources

  • Join Discord Community
  • Tech Events in Nairobi
  • Masterclasses
  • Free Resources
  • Learn
  • Data Science Guides
  • African Payments Reference
  • Campus
  • Africa Tech Talent Report
  • Partner With Us
  • Start a Project
  • Software & AI Studio
  • Our Work
  • Outcomes

Contact Us

  • 124 Manyani East Road, Lavington, Nairobi
  • +254727795603
  • Book a Discovery Call

Office Hours:

Mon-Fri: 9am - 2pm EAT

Sat: 10am - 12pm EAT

© 2026 Mctaba Labs - A product of Edtech Industries. All rights reserved.

Privacy PolicyTerms of ServiceRefund Policy
  1. Learn
  2. Data Science in Kenya
  3. Python for Data Science: Your First 30 Days
Bonaventure OgetoBy Bonaventure Ogeto|Updated November 3, 2026

Last checked 3 November 2026

Python for Data Science: Your First 30 Days

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.

In this article

  1. 1. The small slice of Python you need
  2. 2. Weeks 1 and 2: variables, loops, lists, functions
  3. 3. Week 3: read a file and clean it
  4. 4. Days 22 to 30: pandas and your first chart
  5. 5. Common mistakes and the next step

The small slice of Python you need

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.

The 30-day plan

DaysTopicYou finish with
1 to 7Variables, numbers, strings, loopsA script that totals a list of payments
8 to 14Lists, dictionaries, functionsA function that groups sales by product
15 to 21Files and CSVA script that reads a sales file
22 to 30pandas and one chartA 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.

Weeks 1 and 2: variables, loops, lists, functions

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.

What to skip

  • Classes and inheritance. You will meet them later, not now.
  • Decorators and generators. Data work rarely needs them in month one.
  • Every string method. Learn 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.

Week 3: read a file and clean it

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.

Days 22 to 30: pandas and your first chart

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.

Your day 30 test

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.

Common mistakes and the next step

  • Copying code you do not understand. Type it out, change one number, and see what breaks.
  • Tutorial hopping. Pick one course and finish it.
  • Using only toy data. By day 25, switch to a file you did not write.
  • Skipping errors. Read the last line of an error first. It usually names the problem.

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.

Key Takeaways

  • ✓Learn the slice of Python that data work uses: loops, dictionaries, functions, files and pandas.
  • ✓Write one small script a week on data you recognise.
  • ✓Skip classes and decorators for the first month.
  • ✓Finish with a notebook on real data, posted on GitHub.

Frequently Asked Questions

Can I learn Python in 30 days?
You can learn the slice that data work uses in 30 days: loops, functions, files and pandas. You will not know all of Python, and you do not need to.
Do I need a powerful laptop for Python data science?
No. Google Colab runs in your browser, so a basic laptop with internet is enough for the first months.
Should I learn Python or SQL first?
Either works. Python first teaches you to think in steps. SQL first gets you to useful answers faster if your data already sits in a database.
How long should I study each day?
One to two focused hours a day is enough. Write code every day, even if only for twenty minutes.

Learn data science on African data

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

Need it live by next month? Our studio builds it

Related guides

  • Data Science in Kenya: The Career Map from First Line of Python to First Job
  • From Excel to Python: A Migration Plan for Analysts
  • Learn Data Science While Working: A Plan for Nairobi Professionals

Keep reading

Data Science Roadmap for Beginners: 6 Months, Week by Week

Twenty-six weeks, free resources only, and one small project a month built on African data. Follow it alone or use it to check any course you are paying for.

Read more

SQL for Data Analysis: Queries You Will Use Every Week

Five query patterns cover most weekly analyst work. Each is shown on a made-up mobile money table, in PostgreSQL syntax.

Read more

The Statistics You Actually Need for Data Science

Five statistics ideas do most of the work in data jobs. Each one comes with a small worked example you can check on paper.

Read more

Kenyan Open Datasets: Where to Find Real Data to Practise On

Where to find real Kenyan data for practice projects: eight sources, what each holds, the file format and the date we opened it.

Read more

Explore related topics

Breaking Into Tech

Practical, no-nonsense guides for anyone looking to start or change their career in tech. From choosing your first language to acing interviews.

Tech Salary Data

Transparent salary data for tech roles in Africa and worldwide, updated regularly with real market research.

AI Skills & Tools

Practical AI knowledge for developers. Build your first agent, get good at RAG, and pick the right AI coding tools for real work.

Bonaventure Ogeto

Bonaventure Ogeto

Founder and CEO, Mctaba Labs

Software engineer for 8+ years. He runs a Nairobi studio that ships products on M-Pesa, WhatsApp and AI, and teaches what the studio ships. He holds a BSc in Mathematics and Computer Science.

More about the author