File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1+ venv /
2+ * .csv
Original file line number Diff line number Diff line change 1010 rows .append (row )
1111csv_file .close ()
1212
13- years = range (2016 , 2022 )
13+ years = range (2016 , 2023 )
1414
1515counts = {} # make empty dictionary for yearly counts
1616
2828for year in years :
2929 print (f'{ year } : { counts [year ]:>5} ' )
3030print (f'Yhteensä: { len (rows )} ' )
31+
32+ # Tee ennen tätä virtuaaliympäristö samaan hakemistoon
33+ # missä projekti on: `python3 -m venv venv`.
34+ # Aktivoi virtuaaliympäristö: `source venv/bin/activate`
35+ # Asenna sitten Matplotlib: `pip install matplotlib`.
36+ # Kun olet lopettanut projektin työstämisen,
37+ # anna komento `deactivate`.
38+
39+ import matplotlib .pyplot as plt
40+
41+ values = [counts [k ] for k in sorted (list (counts .keys ()))]
42+ plt .bar (sorted (list (counts .keys ())), values ,
43+ tick_label = sorted (list (counts .keys ())))
44+ plt .show ()
You can’t perform that action at this time.
0 commit comments