From ba40fe82da84fbfcf21d9e9eb38a8d0db763da37 Mon Sep 17 00:00:00 2001 From: rubegar <ruben.garcia.vazquez@estudiantes.uva.es> Date: Mon, 17 Jun 2024 20:11:00 +0000 Subject: [PATCH] Upload New File --- peticiones.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 peticiones.py diff --git a/peticiones.py b/peticiones.py new file mode 100644 index 0000000..cec6218 --- /dev/null +++ b/peticiones.py @@ -0,0 +1,19 @@ +import csv +from collections import Counter + +def count_thread_names(csv_file): + thread_names = [] + with open(csv_file, 'r') as file: + reader = csv.DictReader(file) + for row in reader: + thread_names.append(row['threadName']) + + count = Counter(thread_names) + + with open('peticiones2.csv', 'w', newline='') as file: + writer = csv.writer(file) + writer.writerow(['threadName', 'numeroPeticiones']) + for thread_name, count in sorted(count.items(), key=lambda x: x[0]): + writer.writerow([thread_name, count]) + +count_thread_names('medidas2.csv') \ No newline at end of file -- GitLab