run this
This commit is contained in:
7
app.py
7
app.py
@@ -25,6 +25,7 @@ def load_data():
|
||||
|
||||
|
||||
def get_aggregated_data(df: pd.DataFrame, interval: str = '5min'):
|
||||
|
||||
# ensure 'datetime' is the index
|
||||
df = df.set_index('datetime')
|
||||
|
||||
@@ -41,7 +42,7 @@ def get_aggregated_data(df: pd.DataFrame, interval: str = '5min'):
|
||||
|
||||
# 3) output for Chart.js
|
||||
return {
|
||||
"times": agg['recorded_at'].tolist(),
|
||||
"times": agg['datetime'].tolist(),
|
||||
"down_90th": agg['down_90th'].round(2).tolist(),
|
||||
"up_90th": agg['up_90th'].round(2).tolist()
|
||||
}
|
||||
@@ -53,10 +54,6 @@ def index():
|
||||
agg = request.args.get("agg", "5min")
|
||||
chart_data = get_aggregated_data(df, agg)
|
||||
|
||||
print(f"down last 10: {chart_data['down_90th'][-10:]}")
|
||||
print(f"down last 10: {chart_data['up_90th'][-10:]}")
|
||||
|
||||
print(math.isnan(chart_data['down_90th'][-1]) or math.isnan(chart_data['up_90th'][-1]))
|
||||
|
||||
#if math.isnan(chart_data['down_90th'][-1]) or math.isnan(chart_data['up_90th'][-1]):
|
||||
#return render_template('local.html', data=df.to_dict(orient='records'), chart_data=chart_data)
|
||||
|
||||
Reference in New Issue
Block a user