@ -1,19 +1,19 @@
import csv
import csv
import datetime
import datetime
from services import io_services , log_services
from services import io_services , log_services
# import pdb
def tally_readings_per_second2 ( data ) :
def tally_readings_per_second2 ( data ) :
time_tallies = dict ( )
time_tallies = dict ( )
for k , v in data . items ( ) :
for item in data :
# print(f"{k} : {v}" )
# print(item[0] )
# time_str = k
key = item [ 0 ]
if ( k in time_tallies ) :
if ( key in time_tallies ) :
time_tallies [ k ] = ( time_tallies [ k ] ) + 1
time_tallies [ key ] = time_tallies [ key ] + 1
print ( f " Updated { time_tallies [ k ] } " )
# print(f"Updated {time_tallies[key]}" )
else :
else :
time_tallies [ k ] = 1
time_tallies [ key ] = 1
# print(f"Added: {time_tallies[k]}")
#print(f"Added {time_tallies[key]}")
# print(time_tallies)
return time_tallies
return time_tallies
def tally_readings_per_second ( ) :
def tally_readings_per_second ( ) :
@ -73,7 +73,9 @@ def main():
# rsp_above_two = get_rps_above(2, time_tallies)
# rsp_above_two = get_rps_above(2, time_tallies)
# flicker_tallies = tally_flickers(rsp_above_two, time_tallies)
# flicker_tallies = tally_flickers(rsp_above_two, time_tallies)
raw_data = io_services . load_raw_data ( " data/test-data-lite.csv " )
raw_data = io_services . load_raw_data ( " data/test-data-lite.csv " )
log_services . print_dictionary ( raw_data )
# log_services.print_list(raw_data)
time_tallies = tally_readings_per_second2 ( raw_data )
log_services . print_dictionary ( time_tallies )
if __name__ == " __main__ " :
if __name__ == " __main__ " :
main ( )
main ( )