fix: ensure full hist-preds is kept

This commit is contained in:
robcaulk
2024-04-09 17:17:11 +02:00
parent d8aaaa34d3
commit 081e50ec48
+10 -14
View File
@@ -306,20 +306,16 @@ class FreqaiDataDrawer:
"predictions. You likely left your FreqAI instance offline " "predictions. You likely left your FreqAI instance offline "
f"for more than {len(dataframe.index)} candles.") f"for more than {len(dataframe.index)} candles.")
if len(new_pred.index) == 0: # Pandas warns that its keeping dtypes of non NaN columns...
df_concat = hist_preds.tail( # yea we know and we already want that behavior. Ignoring.
len(dataframe.index)).reset_index(drop=True) with warnings.catch_warnings():
else: warnings.filterwarnings("ignore", category=FutureWarning)
# Pandas warns that its keeping dtypes of non NaN columns... # reindex new_pred columns to match the historic predictions dataframe
# yea we know and we already want that behavior. Ignoring. new_pred_reindexed = new_pred.reindex(columns=hist_preds.columns)
with warnings.catch_warnings(): df_concat = pd.concat(
warnings.filterwarnings("ignore", category=FutureWarning) [hist_preds, new_pred_reindexed],
# reindex new_pred columns to match the historic predictions dataframe ignore_index=True
new_pred_reindexed = new_pred.reindex(columns=hist_preds.columns) )
df_concat = pd.concat(
[hist_preds, new_pred_reindexed],
ignore_index=True
)
# any missing values will get zeroed out so users can see the exact # any missing values will get zeroed out so users can see the exact
# downtime in FreqUI # downtime in FreqUI