Filtrer les sets sans minifigs dans le graphique step21
This commit is contained in:
parent
1d3c035978
commit
e8cd0d346d
@ -16,7 +16,9 @@ def load_counts(path: Path) -> List[dict]:
|
|||||||
|
|
||||||
def plot_minifigs_per_set(counts_path: Path, destination_path: Path) -> None:
|
def plot_minifigs_per_set(counts_path: Path, destination_path: Path) -> None:
|
||||||
"""Trace un diagramme en barres du nombre de minifigs par set (thèmes filtrés)."""
|
"""Trace un diagramme en barres du nombre de minifigs par set (thèmes filtrés)."""
|
||||||
rows = load_counts(counts_path)
|
rows = [row for row in load_counts(counts_path) if int(row["minifig_count"]) > 0]
|
||||||
|
if not rows:
|
||||||
|
return
|
||||||
labels = [f"{row['set_num']} - {row['name']}" for row in rows]
|
labels = [f"{row['set_num']} - {row['name']}" for row in rows]
|
||||||
values = [int(row["minifig_count"]) for row in rows]
|
values = [int(row["minifig_count"]) for row in rows]
|
||||||
positions = list(range(len(rows)))
|
positions = list(range(len(rows)))
|
||||||
|
|||||||
@ -17,6 +17,7 @@ def test_plot_minifigs_per_set_outputs_image(tmp_path: Path) -> None:
|
|||||||
"set_num,set_id,name,year,minifig_count\n"
|
"set_num,set_id,name,year,minifig_count\n"
|
||||||
"123-1,123,Set A,2020,2\n"
|
"123-1,123,Set A,2020,2\n"
|
||||||
"124-1,124,Set B,2021,1\n"
|
"124-1,124,Set B,2021,1\n"
|
||||||
|
"125-1,125,Set C,2021,0\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
plot_minifigs_per_set(counts_path, destination_path)
|
plot_minifigs_per_set(counts_path, destination_path)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user