You've already forked etude_lego_jurassic_world
Création d'un fichier intermédiaire pour les statistiques sur les couleurs
This commit is contained in:
27
scripts/build_colors_by_set.py
Normal file
27
scripts/build_colors_by_set.py
Normal 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()
|
||||
Reference in New Issue
Block a user