You've already forked etude_lego_jurassic_world
Ajoute l'analyse des pièces rares
This commit is contained in:
28
scripts/compute_rare_parts.py
Normal file
28
scripts/compute_rare_parts.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""Calcule les pièces rares (variantes exclusives) et leurs agrégats."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from lib.rebrickable.rare_parts import (
|
||||
build_rare_parts,
|
||||
write_rare_parts_by_set,
|
||||
write_rare_parts_list,
|
||||
)
|
||||
|
||||
|
||||
PARTS_PATH = Path("data/intermediate/parts_filtered.csv")
|
||||
SETS_PATH = Path("data/intermediate/sets_enriched.csv")
|
||||
PARTS_CATALOG_PATH = Path("data/raw/parts.csv")
|
||||
COLORS_PATH = Path("data/raw/colors.csv")
|
||||
RARE_PARTS_PATH = Path("data/intermediate/rare_parts.csv")
|
||||
RARE_PARTS_BY_SET_PATH = Path("data/intermediate/rare_parts_by_set.csv")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Construit les fichiers listant les pièces rares et leur répartition par set."""
|
||||
rare_parts, rare_by_set = build_rare_parts(PARTS_PATH, SETS_PATH, PARTS_CATALOG_PATH, COLORS_PATH)
|
||||
write_rare_parts_list(RARE_PARTS_PATH, rare_parts)
|
||||
write_rare_parts_by_set(RARE_PARTS_BY_SET_PATH, rare_by_set)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
18
scripts/plot_rare_parts.py
Normal file
18
scripts/plot_rare_parts.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""Trace le top des sets avec pièces exclusives."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from lib.plots.rare_parts import plot_rare_parts_per_set
|
||||
|
||||
|
||||
RARE_PARTS_BY_SET_PATH = Path("data/intermediate/rare_parts_by_set.csv")
|
||||
DESTINATION_PATH = Path("figures/step27/rare_parts_per_set.png")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Génère le visuel des pièces rares par set."""
|
||||
plot_rare_parts_per_set(RARE_PARTS_BY_SET_PATH, DESTINATION_PATH)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user