Mctaba Labs logo
BootcampData ScienceThe 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
  • 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. From Excel to Python: A Migration Plan for Analysts
Bonaventure OgetoBy Bonaventure Ogeto|Updated November 3, 2026

Last checked 3 November 2026

From Excel to Python: A Migration Plan for Analysts

Pick one monthly Excel report and rebuild it in Python over four weeks. Week one: load the files. Week two: replace VLOOKUP with a merge. Week three: replace pivot tables with groupby and pivot_table. Week four: run both versions side by side, compare the totals, then retire the manual steps.

In this article

  1. 1. Move one report, not your whole life
  2. 2. Week 1: load and clean
  3. 3. Week 2: VLOOKUP becomes a merge
  4. 4. Week 3: pivot tables become groupby and pivot_table
  5. 5. Week 4: run both, compare, then retire the manual steps
  6. 6. What Excel still does better

Move one report, not your whole life

McTaba runs coding and data bootcamps in Kenya. This guide is written to be useful whether or not you ever join one.

Imagine the last working day of the month. You open the sales workbook, paste in the till export, refresh four pivot tables, fix the dates that came in as text, and email the file. It takes three hours, and a pasted row in the wrong place breaks it.

Python does that job in one command, and it does it the same way every time. You do not need to leave Excel. Managers will still read Excel files. You only change who builds them.

Pick one report you run every month. That is your migration project. The wider skill set Python belongs to is mapped in our data science career guide for Kenya.

The four-week plan

WeekTaskExcel step it replaces
1Load and clean files with pandasPaste, trim, fix dates
2Merge tablesVLOOKUP and XLOOKUP
3Group and pivotPivot tables and SUMIFS
4Compare, export, scheduleManual checking and emailing

If you would rather learn this in a class, the Data Science to AI Engineering programme teaches Python from zero and then pandas. No coding, data or maths background needed.

Week 1: load and clean

Install nothing yet. Open Google Colab, upload your till export, and read it. If the first steps in Python are new, start with our first 30 days of Python.

import pandas as pd

sales = pd.read_excel("october_sales.xlsx")   # or read_csv for a .csv
print(sales.head())
print(sales.dtypes)

Now write down every manual fix you do in Excel and turn each into one line.

sales["product"] = sales["product"].str.strip().str.lower()
sales["date"] = pd.to_datetime(sales["date"], dayfirst=True)
sales = sales.drop_duplicates()
sales["revenue"] = sales["qty"] * sales["price"]

Notice dayfirst=True. Kenyan files usually write 03/10/2026 as 3 October. Without it, pandas may read it as 10 March. Check a few rows by eye.

Week one goal: a notebook that loads October and makes the same clean table you get after your manual fixes.

Get weekly developer tips

Join 25,000+ developers. Practical guides, job tips, and new content — straight to your inbox.

No spam. Unsubscribe anytime.

Week 2: VLOOKUP becomes a merge

VLOOKUP pulls a column from another table using a shared key. In pandas the same job is merge. Imagine a made-up price list sheet with product and category, and a sales table with product and revenue.

catalogue = pd.read_excel("catalogue.xlsx")   # product, category

merged = sales.merge(catalogue, on="product", how="left")

# rows that found no match are the #N/A cells in Excel
missing = merged[merged["category"].isna()]
print(len(missing), "sales rows with no category")

Three differences from VLOOKUP that help you:

  • The key can be on any column, not only the left one.
  • how="left" keeps every sale, even without a match. Use "inner" to keep only matches.
  • Duplicate keys in the lookup table multiply your rows. Check the row count before and after, as you would with a JOIN in SQL for data analysis.

Week two goal: your merged table has the same row count as the raw data, and you have a list of unmatched products to fix at the source.

Week 3: pivot tables become groupby and pivot_table

A pivot table groups rows and adds them up. The simplest form is groupby.

by_category = (
    merged.groupby("category")["revenue"]
    .sum()
    .sort_values(ascending=False)
)
print(by_category)

When you need rows and columns, as in a classic pivot, use pivot_table:

report = pd.pivot_table(
    merged,
    index="category",
    columns=merged["date"].dt.to_period("W").astype(str),
    values="revenue",
    aggfunc="sum",
    fill_value=0,
    margins=True,        # adds the Total row and column
)
print(report)

SUMIFS maps onto a filter plus a sum: merged.loc[merged["category"] == "dairy", "revenue"].sum(). The pandas reshaping guide documents pivot_table in full.

Week three goal: the pivot in Python matches the pivot in last month's workbook, cell for cell.

Week 4: run both, compare, then retire the manual steps

Do not switch off the Excel version yet. Run both for one month end and compare the totals.

excel_total = 4_812_300      # type the total from the workbook (made-up number)
python_total = merged["revenue"].sum()
print("Difference:", python_total - excel_total)

If the difference is not zero, you have found something useful. Often the manual file had a stray filter or a pasted row. Fix the cause and note it. A mismatch you can explain builds more trust than a match you cannot.

Export for people who want Excel

with pd.ExcelWriter("october_report.xlsx") as writer:
    report.to_excel(writer, sheet_name="By category")
    missing.to_excel(writer, sheet_name="Unmatched")

Your manager still opens an Excel file. Last, put the code in a single function, build_report("october"), so that next month you change one word and run it.

Once the report builds itself, you have time for the next question: which numbers deserve trust, and how to tell a manager. See data storytelling for the memo.

What Excel still does better

  • Quick one-off looks. For ten rows you will never see again, Excel is faster.
  • Shared editing. A finance team typing into one sheet needs a spreadsheet.
  • Formatting for print. Python can export, but fine layout is easier by hand.

Move the repeatable, error-prone work to Python and keep Excel for everything else. No school can promise you a job from this switch, but it is a skill analysts list on their CVs, and you can show a working project instead of saying you know it. If you want a class, the Data Science to AI Engineering programme starts on 11 January 2027 and costs KES 140,000.

Key Takeaways

  • ✓Migrate one monthly report, not everything at once.
  • ✓VLOOKUP becomes merge, and pivot tables become groupby or pivot_table.
  • ✓Run the old and new versions side by side and explain every difference.
  • ✓Keep Excel for quick looks and shared editing.

Frequently Asked Questions

Can Python replace Excel?
For repeated reports and large files, yes. For one-off checks and shared typing, Excel is still faster. Most analysts end up using both.
What is the Python equivalent of VLOOKUP?
The pandas merge function. It joins two tables on a shared column, and how="left" keeps every row of the main table like a VLOOKUP does.
How do I make a pivot table in Python?
Use groupby for a simple total by one column, or pivot_table when you need both rows and columns, with aggfunc="sum" and margins=True for totals.
How long does it take an Excel user to learn Python?
Four weeks of steady practice on one real report is enough to rebuild it. Expect to keep learning for months after that.

Learn data science on African data

KES 140,000

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

  • Analyse Your M-Pesa Statement in Python
  • Forecast a Shop's Stock from Till Data
  • Learn Data Science While Working: A Plan for Nairobi Professionals

Keep reading

Python for Data Science: Your First 30 Days

Thirty days, four weeks, one small script a week. Learn only the parts of Python that data work uses, with examples on made-up Kenyan shop data.

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

Data Storytelling: Turning a Chart into a Decision

A chart is not the finish line. This guide shows the one-page memo, a simple way to pick a chart, and a before and after on made-up shop data.

Read more

Excel and Power BI or Python? What Kenyan Employers Ask For

A dated count of 62 data job ads on MyJobMag Kenya, split by analyst, scientist and engineer roles, with the method and the limits spelled out.

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