Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/anomaly-detection-platform' into…
Browse files Browse the repository at this point in the history
… anomaly-detection-platform
  • Loading branch information
hahahannes committed Apr 24, 2024
2 parents 62dab73 + f1f85f8 commit 990c294
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions algo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pickle
import torch
import os
from pyarrow.lib import ArrowInvalid

import operator_lib.util as util

Expand Down Expand Up @@ -159,12 +160,15 @@ def load_data(filename_dict, data_list, initial_time, first_data_time, last_trai

if os.path.exists(data_path):
data_list = []
df = pd.read_parquet(data_path)
df.index = pd.to_datetime(df.index)
data_series = pd.Series(data=df['power_values'], index=df.index)
data_series = df[~df.index.duplicated(keep='first')]
for i in range(len(data_series.index)):
data_list.append([data_series.index[i], float(data_series.iloc[i])])
try:
df = pd.read_parquet(data_path)
df.index = pd.to_datetime(df.index)
data_series = pd.Series(data=df['power_values'], index=df.index)
data_series = df[~df.index.duplicated(keep='first')]
for i in range(len(data_series.index)):
data_list.append([data_series.index[i], float(data_series.iloc[i])])
except ArrowInvalid:
print("Data buffer could not be loaded! This might be caused by not having any data in the buffer yet.")

if os.path.exists(initial_time_path):
with open(initial_time_path, 'rb') as f:
Expand Down

0 comments on commit 990c294

Please sign in to comment.