You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
902 B
29 lines
902 B
3 years ago
|
import csv
|
||
|
import datetime
|
||
|
|
||
|
time_tallies = dict()
|
||
|
tally_totals = dict()
|
||
|
|
||
|
with open("data/light-meter-sample-readings-23-04-2021-ritherdon.csv") as csv_file:
|
||
|
csv_reader = csv.reader(csv_file, delimiter=",")
|
||
|
for r in csv_reader:
|
||
|
if (r[1] != "Time Stamp"):
|
||
|
time_str = r[1]
|
||
|
if (time_str in time_tallies):
|
||
|
time_tallies[time_str] = (time_tallies[time_str]) + 1
|
||
|
else:
|
||
|
time_tallies[time_str] = 1
|
||
|
for r2 in time_tallies.values():
|
||
|
if (r2 in tally_totals):
|
||
|
tally_totals[r2] = (tally_totals[r2]) + 1
|
||
|
else:
|
||
|
tally_totals[r2] = 1
|
||
|
#print(tally_totals)
|
||
|
print(tally_totals.items())
|
||
|
with open("data/results/23-04-2021-readings-per-sec.csv", mode="w") as result:
|
||
|
wtr = csv.writer(result)
|
||
|
for k, v in tally_totals.items():
|
||
|
print(f"{k}: {v}")
|
||
|
wtr.writerow([k,v])
|
||
|
|