HomeCourseModule 01 › The Excel-to-Python mental model

The Excel-to-Python mental model

Module 01 · Introduction to Python9 min readBeginner

What you'll learn

  • Map five Excel concepts to their Python equivalents
  • Recognise a pandas DataFrame as 'just a sheet'
  • Feel a lot less intimidated by Python syntax

You already know more than you think

People often say "Python is hard because it's a programming language." The truth is: if you've used Excel formulas, you've already met most of the concepts. They just have different names. Let's translate.

The translation table

Excel conceptPython equivalentWhy they're the same
A cell holding a value: A1 = 100A variable: a1 = 100Both are a named container for a value.
A formula: =SUM(A1:A10)A function call: sum(numbers)Both take inputs and give back one output.
A range: A1:A10A list: [100, 200, 300, ...]Both are an ordered group of values.
A table / structured rangeA pandas DataFrameBoth are rows-and-columns with named headers.
A VLOOKUP tableA dictionary: {"apple": 1.20, ...}Both are a key-to-value lookup.
IF(A1>10, "big", "small")if a1 > 10: "big"
else: "small"
Both branch on a condition.
Filling a formula down 100 rowsA for loopBoth apply the same logic across many items.
A macro (VBA)A Python scriptBoth are saved instructions you run on demand.
An add-inA library (pandas, numpy, etc.)Both add capabilities the base tool doesn't have.

Three quick "Wait, that's it?" examples

Adding numbers in a range

Excel:

=SUM(A1:A5)

Python:

numbers = [10, 20, 30, 40, 50]
total = sum(numbers)
print(total)   # 150

Looking up a value

Excel:

=VLOOKUP("apple", A1:B10, 2, FALSE)

Python:

prices = {"apple": 1.20, "pear": 1.50, "banana": 0.40}
print(prices["apple"])   # 1.2

"If A1 is greater than 10, say 'big', otherwise 'small'"

Excel:

=IF(A1>10, "big", "small")

Python:

a1 = 14
if a1 > 10:
    result = "big"
else:
    result = "small"
print(result)   # big

The DataFrame: the most important translation

If there's only one Python concept you remember from this lesson, make it the DataFrame. It's the pandas library's word for a table of data. It has rows. It has named columns. You can sort it, filter it, group it, summarise it. It is, for all practical purposes, an Excel sheet that lives inside Python.

Once you internalise that mental model — "DataFrame = Sheet" — every example in Modules 9 through 16 will feel familiar.

import pandas as pd

# This DataFrame is basically:
#   Name      Sales
#   Alice     1200
#   Bob       800
#   Carol     1500

df = pd.DataFrame({
    "Name":  ["Alice", "Bob", "Carol"],
    "Sales": [1200,    800,    1500],
})

print(df["Sales"].sum())   # 3500 — like =SUM(B2:B4)
💡 If you keep one slide
Variable = cell. Function = formula. List = range. DataFrame = sheet. Dictionary = VLOOKUP. Loop = fill down.

Key takeaways

  • Most Python concepts have a direct Excel equivalent.
  • A DataFrame is the pandas word for a sheet — keep that mapping in your head.
  • If you can write formulas, you can write Python. You're not starting from zero.

Translate these three formulas to Python

Try to translate each on paper before scrolling down. Answers below.

  1. =A1 + A2
  2. =AVERAGE(A1:A5)
  3. =IF(A1="VIP", A2*0.9, A2)
Show answers
  1. a1 + a2
  2. sum(numbers) / len(numbers)  — or with pandas: df["A"].mean()
  3. a2 * 0.9 if a1 == "VIP" else a2
📹 Video walkthrough
A video walkthrough of this lesson will be embedded here. Until then, the written walkthrough above mirrors what the video will cover step-for-step.