Skip to content

Commit

Permalink
Added longest delta
Browse files Browse the repository at this point in the history
  • Loading branch information
charleshenville committed Jan 23, 2024
1 parent b4c6ed3 commit 536f0eb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion backend/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ def obliterate_long_delta(df, maxdelta):
modded_df = df
time_list = df['time'].tolist()
last_time = time_list[0]

longest_delta = 0

for idx, time in enumerate(time_list):
if time-last_time >= maxdelta:

newdelta = time-last_time
if newdelta > longest_delta:
longest_delta = newdelta
if newdelta>= maxdelta:
modded_df=df.drop(index=range(idx))
last_time = time
print("Longest Delta: {delta}".format(delta=longest_delta))

return modded_df

0 comments on commit 536f0eb

Please sign in to comment.