i commited last idk when , so updates
This commit is contained in:
2967
csv/autos/cars.csv
Normal file
2967
csv/autos/cars.csv
Normal file
File diff suppressed because it is too large
Load Diff
35
csv/autos/main.py
Normal file
35
csv/autos/main.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# -*- coding: ansi -*-
|
||||
import csv
|
||||
from collections import defaultdict
|
||||
|
||||
def auswertung(csvf: str):
|
||||
try:
|
||||
with open(csvf, "r") as f:
|
||||
reader = csv.reader(f, delimiter=";")
|
||||
|
||||
header = next(reader)
|
||||
|
||||
marken_count = defaultdict(int)
|
||||
total_dataset = 0
|
||||
|
||||
for row in reader:
|
||||
if len(row) < 2:
|
||||
continue
|
||||
|
||||
total_dataset += 1
|
||||
marke = row[1]
|
||||
marken_count[marke] += 1
|
||||
|
||||
print(f"Insgesamt sind {total_dataset} Datens<6E>tze gespeichert!")
|
||||
print(f"Insgesamt sind {len(marken_count)} verschiedene Automarken gespeichert!")
|
||||
|
||||
print()
|
||||
|
||||
for i, marke in enumerate(sorted(marken_count.keys()), start=1):
|
||||
print(f"{i} : {marke} ist {marken_count[marke]} mal in der Liste gespeichert")
|
||||
|
||||
except FileNotFoundError:
|
||||
|
||||
|
||||
|
||||
auswertung("cars.csv")
|
||||
Reference in New Issue
Block a user