Skip to main content
Back to module
Intro to Data Analysis with Python · Python for Data People

Why Python for data?

Reading47mLesson 1 of 3 in this module

Compare Python with spreadsheets and learn when each is the right tool for an analysis.

Why it matters

Most people meet data in a spreadsheet, and spreadsheets are good tools. You can see every cell, sort with a click and build a chart in seconds. So why does nearly every data analyst, data scientist, statistician and lab scientist job listing ask for Python as well?

The short answer: once an analysis has to be repeated, checked or scaled, a script beats a sequence of clicks. This lesson compares the two honestly, so you know when to reach for each.

What a spreadsheet does well

  • Seeing the data. Scrolling through rows is the fastest way to spot an obviously wrong value.
  • Small, one-off questions. "What was the total in March?" is a SUM and you are done.
  • Sharing with non-programmers. Almost everyone can open an .xlsx file.
  • Light what-if modelling. Change an input cell and watch the result update.

If the job is a single, small, look-once question, a spreadsheet is often the right answer. Do not let anyone tell you otherwise.

Where Python pulls ahead

1. Repeatability. Suppose you clean a monthly export: trim spaces, fix dates, remove test rows, then build a summary. In a spreadsheet those are a dozen manual steps you must redo, in the same order, every month. In Python they are a script:

import pandas as pd

df = pd.read_csv("orders_2026_10.csv")
df["region"] = df["region"].str.strip().str.title()
df = df[df["customer"] != "TEST"]
summary = df.groupby("region")["revenue"].sum()
print(summary)

Next month you change one file name and run it again. The steps cannot be done out of order or skipped by accident.

2. An audit trail. The script is the record of what you did. A colleague (or you, six months later) can read every step. A spreadsheet hides its logic in cell formulas and in actions nobody wrote down, such as "I deleted the duplicate rows by hand".

3. Size. Excel stops at 1,048,576 rows, and it gets slow well before that. pandas handles millions of rows on a laptop, and other Python tools go further.

4. Combining sources. Joining a CSV export, a database table and a JSON API response is a few lines of Python. In a spreadsheet it usually means copy, paste and VLOOKUP, which breaks silently when a key is missing.

5. The wider toolkit. The same language gives you statistics (scipy, statsmodels), charts (matplotlib, seaborn), machine learning (scikit-learn) and automation (scheduled reports, emails, file handling). Learning Python for analysis is also the first step toward those.

The libraries you will use

LibraryWhat it gives you
pandasThe DataFrame: a table with named columns, plus tools to load, clean, filter, group and join
NumPyFast arrays and maths; pandas is built on top of it
matplotlibCharts; pandas uses it for df.plot()
JupyterNotebooks that mix code, output, charts and notes in one document

This course uses pandas and NumPy in the browser exercises. Charts and notebooks are covered in the readings and the notebook warm-up.

A worked comparison

Task: from a 50,000-row sales export, find the average order value per region, excluding refunds, every Monday.

Spreadsheet route: open the file, filter out refunds, insert a pivot table, set rows = region and values = average of order value, copy the result into the weekly report. About 5 minutes, every week, and easy to get subtly wrong (forgetting the refund filter one week, or including the totals row).

Python route: about 15 minutes to write the first time, then seconds each week:

df = pd.read_csv("sales.csv")
clean = df[df["type"] != "refund"]
print(clean.groupby("region")["order_value"].mean().round(2))

By the third week the script has paid for itself, and it never forgets the filter.

Working with both

In real jobs the two tools live side by side. A common pattern is to explore a sample in a spreadsheet, write the repeatable pipeline in Python, and export the final summary back to Excel for the people who need it (summary.to_excel("report.xlsx")). Microsoft now even offers Python inside Excel. Choose the tool that fits the job, not the one that feels most impressive.

Common mistakes

  • Thinking Python replaces understanding the data. You still need to look at rows, question odd values and know what each column means.
  • Rewriting a five-second spreadsheet task as a script. Automate what you will repeat or what must be auditable.
  • Editing the raw file by hand, then scripting the rest. The manual edit is invisible to the script. Keep the raw data untouched and put every change in code.
  • Treating a spreadsheet's display as the value. A cell showing 3.1 may hold 3.14159. Python shows you the real value, which sometimes surprises people.

Quick recap

  • Spreadsheets are great for looking, quick one-off questions and sharing.
  • Python wins when work must be repeated, audited, scaled or combined from several sources.
  • pandas (tables), NumPy (arrays), matplotlib (charts) and Jupyter (notebooks) are the core toolkit.
  • Most analysts use both: explore, script, then export.

Try it

This lesson's Do tab is a short quiz on choosing the right tool.

Also in this lesson: