Created
July 3, 2023 13:23
-
-
Save ngetahun/6f39a4e53d173fb88da9fa694512b122 to your computer and use it in GitHub Desktop.
calculate_elapsed_time.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import csv | |
import time | |
import pandas as pd | |
def clean_input(start, stop): | |
start = time.mktime(time.strptime(start, '%Y-%m-%d %H:%M:%S.%f')) | |
stop = float(int(stop)) | |
return stop, start | |
if __name__ == '__main__': | |
dt = [(x[0], x[1])for x in csv.reader(open(sys.argv[1], 'r'))] | |
dt = [clean_input(*x) for x in dt] | |
dt = pd.DataFrame([v[0] - v[1] for v in dt]) | |
print("Avg: {} Min: {} Max: {}".format(dt.mean(), dt.min(), dt.max())) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment