Start Here

Python for Data

The essential Python toolkit for data analysis — from DataFrames to visualisation and automation.

Beginner Friendly Self-Paced Prerequisites: No prior experience needed
Start Learning Python for Data

What You'll Learn

  • Python fundamentals: variables, lists, dictionaries, loops, functions
  • NumPy arrays — the foundation of all numerical computing in Python
  • pandas DataFrames — loading, cleaning, filtering, and aggregating data
  • Handling missing data, duplicates, and data type conversions
  • Merging and joining DataFrames (like SQL JOINs)
  • GroupBy operations and pivot tables for aggregated reporting
  • Visualising data with Matplotlib and Seaborn
  • Reading from and writing to CSV, Excel, JSON, and SQL databases

Introduction to Python for Data

Python is the number one language for data engineering, data science, and AI — and for good reason. It has an incredible ecosystem of libraries that make working with data intuitive: pandas for tabular data manipulation, NumPy for numerical computing, Matplotlib and Seaborn for visualisation, and PySpark for big data. If you are starting your data career, Python is the first language to learn.

For data work, Python's killer feature is the pandas library, which gives you a DataFrame — a powerful table-like structure you can load from CSV, Excel, JSON, SQL, or API and then filter, aggregate, merge, and analyse with just a few lines of code. What took 100 lines of Java or 20 lines of SQL can often be done in 3 lines of pandas.

Beyond pandas, modern data engineers write Python scripts to automate data pipelines, call REST APIs, transform data between formats, orchestrate workflows with Apache Airflow, and interact with cloud storage (S3, GCS). Learning Python for data means learning both the language fundamentals and the ecosystem of tools built on top of it.

Video Tutorials

Handpicked free YouTube videos to accelerate your understanding

🎧 Playing in English

Complete Pandas Tutorial for Beginners

Keith Galli 1.5 hr 🇬🇧 English

The most comprehensive pandas tutorial — DataFrames, filtering, groupby, merging, reshaping, and real exercises on real datasets.

🎧 Playing in English

Python for Data Analysis — Full Course

freeCodeCamp 4 hr 🇬🇧 English

Full Python data analysis course covering NumPy, Pandas, Matplotlib, and Seaborn from absolute scratch — no prior experience needed.

Data analysis with pandas — from CSV to insights

Copy the code below and paste it into your Python environment or our free online compiler.

python
# Install: pip install pandas matplotlib seaborn

import pandas as pd
import matplotlib.pyplot as plt

# 1. Load data from a CSV file
df = pd.read_csv("sales_data.csv")
print(df.head())        # first 5 rows
print(df.info())        # column names, types, nulls
print(df.describe())    # mean, min, max for numeric columns

# 2. Clean the data
df = df.dropna(subset=["revenue"])         # remove rows with no revenue
df["date"] = pd.to_datetime(df["date"])    # convert string to datetime
df["revenue"] = df["revenue"].astype(float)

# 3. Filter: only Q1 2024 sales
q1 = df[(df["date"] >= "2024-01-01") & (df["date"] < "2024-04-01")]

# 4. Aggregate: total revenue by product category
summary = q1.groupby("category")["revenue"].agg(
    total_revenue="sum",
    avg_revenue="mean",
    num_sales="count"
).reset_index()

print(summary.sort_values("total_revenue", ascending=False))

# 5. Add a derived column
df["revenue_per_unit"] = df["revenue"] / df["units_sold"]

# 6. Merge with a product info table
products = pd.read_csv("products.csv")
merged = df.merge(products, on="product_id", how="left")

# 7. Export the clean result
summary.to_csv("q1_summary.csv", index=False)
print("Analysis complete!")
Want to run this code in your browser — no setup needed? Open Free Compiler →

Key Concepts Explained

Master these terms and you'll understand 80% of the conversations in this field.

DataFrame

The core data structure in pandas. A 2D table with labelled rows (index) and named columns. Think of it as a powerful, programmable spreadsheet.

Series

A single column of a DataFrame — a 1D array with an index. Every column you access from df["column_name"] is a Series.

Vectorisation

Instead of looping row by row (slow), apply operations to the entire column at once (fast). df["price"] * 1.1 multiplies every price by 1.1 in a single operation.

GroupBy

Split the data into groups (e.g., by country), apply a function (e.g., sum revenue), and combine the results. The pandas equivalent of SQL's GROUP BY.

Merge / Join

Combine two DataFrames on a common key. pd.merge(df1, df2, on="id", how="left") is equivalent to a SQL LEFT JOIN.

Missing Data (NaN)

Pandas represents missing values as NaN. Use df.isna() to find them, dropna() to remove rows, or fillna(0) to replace with a default value.

NumPy ndarray

A multi-dimensional array optimised for numerical operations. Much faster than Python lists for maths. Pandas DataFrames are built on top of NumPy arrays.

List Comprehension

A concise way to create lists: [x*2 for x in range(10)]. Essential Python syntax used throughout data scripts and pipeline code.

Your Python for Data Learning Path

Follow these steps in order — each one builds on the last. Designed for complete beginners.

  1. 1

    Python Basics

    Variables, data types, lists, dicts, if/else, for loops, functions, and f-strings. Takes 1-2 weeks with daily practice.

  2. 2

    NumPy

    Create and manipulate arrays, understand broadcasting (operations on arrays of different shapes), and use vectorised math operations.

  3. 3

    pandas Fundamentals

    Load data, inspect shapes, select rows/columns, filter, sort, and handle missing values.

  4. 4

    pandas Aggregations

    Master groupby, pivot_table, value_counts, and cumulative operations. These are used in almost every data analysis.

  5. 5

    Data Visualisation

    Plot histograms, bar charts, scatter plots, and heatmaps with Matplotlib and Seaborn to communicate findings.

  6. 6

    Working with APIs & Files

    Use requests to call REST APIs, parse JSON, read Excel files, and connect to SQL databases with SQLAlchemy.

  7. 7

    Automation & Pipelines

    Write Python scripts that run automatically. Schedule with cron or Airflow. Move from ad-hoc analysis to reliable data pipelines.

Ready to master Python for Data?

Explore our free tutorials, hands-on code examples, and interview questions. No sign-up. No paywalls. Forever free.