aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/dash/app/pal/stats/graphs.py
diff options
context:
space:
mode:
Diffstat (limited to 'resources/tools/dash/app/pal/stats/graphs.py')
-rw-r--r--resources/tools/dash/app/pal/stats/graphs.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/resources/tools/dash/app/pal/stats/graphs.py b/resources/tools/dash/app/pal/stats/graphs.py
index 37fc1b2e73..d9f49407d9 100644
--- a/resources/tools/dash/app/pal/stats/graphs.py
+++ b/resources/tools/dash/app/pal/stats/graphs.py
@@ -19,12 +19,16 @@ import pandas as pd
from datetime import datetime, timedelta
-def select_data(data: pd.DataFrame, itm:str) -> pd.DataFrame:
+def select_data(data: pd.DataFrame, itm:str, start: datetime,
+ end: datetime) -> pd.DataFrame:
"""
"""
- df = data.loc[(data["job"] == itm)].sort_values(
- by="start_time", ignore_index=True)
+ df = data.loc[
+ (data["job"] == itm) &
+ (data["start_time"] >= start) & (data["start_time"] <= end)
+ ].sort_values(by="start_time", ignore_index=True)
+ df = df.dropna(subset=["duration", ])
return df
@@ -35,14 +39,7 @@ def graph_statistics(df: pd.DataFrame, job:str, layout: dict,
"""
"""
- data = select_data(df, job)
- data = data.dropna(subset=["duration", ])
- if data.empty:
- return None, None
-
- data = data.loc[(
- (data["start_time"] >= start) & (data["start_time"] <= end)
- )]
+ data = select_data(df, job, start, end)
if data.empty:
return None, None