1

Création d'un fichier intermédiaire pour les statistiques sur les couleurs

This commit is contained in:
2025-12-01 22:15:48 +01:00
parent cf83f51f89
commit 4f42303eac
5 changed files with 228 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
"""Construit l'agrégat set × couleur prêt pour les visualisations."""
from pathlib import Path
from lib.rebrickable.colors_by_set import (
aggregate_colors_by_set,
build_colors_lookup,
load_parts,
write_colors_by_set,
)
PARTS_PATH = Path("data/intermediate/parts_filtered.csv")
COLORS_PATH = Path("data/raw/colors.csv")
DESTINATION_PATH = Path("data/intermediate/colors_by_set.csv")
def main() -> None:
"""Génère colors_by_set.csv depuis parts_filtered.csv."""
parts = load_parts(PARTS_PATH)
colors_lookup = build_colors_lookup(COLORS_PATH)
aggregated = aggregate_colors_by_set(parts, colors_lookup)
write_colors_by_set(DESTINATION_PATH, aggregated)
if __name__ == "__main__":
main()