Tirsvad e8ed831324
TirSystem/git-workflows: Publish wiki / publish-wiki (push) Skipped
TirSystem/git-workflows: Release / release (push) Skipped
TirSystem/git-workflows: Sync GitHub mirror metadata / sync-metadata (push) Successful in 15s
TirSystem/git-workflows: Validate / validate (push) Successful in 38s
TirSystem/git-workflows: Publish accepted milestones / publish (push) Successful in 46s
TirSystem/git-workflows: OpenGrep / opengrep (push) Successful in 1m41s
Merge pull request 'MIL-005: bring the project to the framework baseline' (#47) from mil-005-framework-baseline into main
2026-11-16 07:19:03 +01:00
2026-11-16 14:16:37 +08:00
2026-11-11 16:13:54 +01:00

🚀 074 LEGO Analysis for Course

Day 74 of Udemy's 100 Days of Code: The Complete Python Pro Bootcamp: aggregate and merge data in Pandas while analysing a dataset of LEGO sets. It is for course participants who want runnable, tested code and for anyone browsing for ideas.

📚 Table of Contents

🧭 Overview

The project answers five questions about LEGO: the largest set ever made, the year of the first sets, the theme with most sets, how the product range grew each year, and whether sets got bigger over time.

Folder What it holds
src/lego_analysis/ The analysis functions, named as in the assignment
tests/ Tests that assert every value from the lecture
notebooks/ The Jupyter notebook that follows the lecture step by step
data/ colors.csv, sets.csv and themes.csv from the lecture (a 2020 snapshot of the Rebrickable database)
notebooks/assets/ Images supplied with the lecture, next to the notebook that shows them
docs/ Project documents, screenshots (docs/images/) and the wiki sources (docs/wiki/: English, Danish, Bahasa Malaysia)
scripts/ scan.sh (opengrep) and make_screenshots.py
framework/ The SQA and QC framework (a git submodule) that the project documents follow
.editorconfig The editor settings of the framework baseline
.env.example Placeholders for the git host tokens that the framework scripts read; the program itself reads no setting from .env

🖼️ Lecture steps

One screenshot per lecture step, generated from the code with python scripts/make_screenshots.py. The wiki (English, Dansk, Bahasa Malaysia) explains what each step teaches.

Step 1: Exploring the brick colours

Step 1: Exploring the brick colours

Step 2: The oldest and the largest sets

Step 2: The oldest and the largest sets

Step 3: Sets released per year

Step 3: Sets released per year

Step 4: Themes per year with .agg()

Step 4: Themes per year with .agg()

Step 5: Two axes in one chart

Step 5: Two axes in one chart

Step 6: Average parts per set

Step 6: Average parts per set

Step 7: Themes, primary keys and foreign keys

Step 7: Themes, primary keys and foreign keys

Step 8: Merging DataFrames on a key

Step 8: Merging DataFrames on a key

Step 9: A bar chart of the top 10 themes

Step 9: A bar chart of the top 10 themes

📋 Requirements

  • Python 3.13 or newer, to run the code.
  • pandas and matplotlib, the only runtime dependencies; they are installed by the setup below.
  • pytest, ruff and Jupyter, only for development; installed with the dev extra.

🛠️ Setup

Create and use a local virtual environment named .venv.

Windows (PowerShell):

python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"

Linux and macOS:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"

Leave out [dev] if you only want to run the analysis.

▶️ Run

Print the answers to the five questions:

python -m lego_analysis

Open the notebook:

jupyter lab notebooks/Lego_Analysis_for_Course.ipynb

🧪 Tests

python -m pytest
python -m mypy

python -m mypy runs the strict type check configured in pyproject.toml on src and tests.

Before pushing, scan the code with opengrep (default path ~/.opengrep/cli/latest/opengrep.exe):

bash scripts/scan.sh

📄 License

GNU Affero General Public License v3.0 only (AGPL-3.0-only), see LICENSE.

📎 Appendix: Project documents

The documents a newcomer needs, in reading order.

Document What it tells you
Business Case Why the project exists, its scope and success criteria
Stakeholder Analysis Who is involved; the stakeholder IDs used for owners and reviewers
Project Plan The gateways and their schedule
Milestones One document per gateway: Go/No-Go criteria and tasks
Artifact registry Where each artifact type lives, the next version, the PO language and domain
Wiki sources The lecture steps explained in English, Danish and Bahasa Malaysia
Traceability matrix How the artifacts link and when each was last reviewed

S
Description
Udemy 100 Days of Code, Day 74: aggregate and merge data in Pandas while analysing a LEGO dataset. Tested Python package, Jupyter notebook and a wiki in English, Danish and Bahasa Malaysia.
https://www.udemy.com/course/100-days-of-code/ Readme AGPL-3.0
3.9 MiB
0 Stars 1 Watchers 0 Forks
Languages
Jupyter Notebook 87.4%
Python 12.4%
Shell 0.2%