From fc53054d431ab38d2ac42769b38b9d1de622b1e0 Mon Sep 17 00:00:00 2001 From: robcaulk Date: Sun, 30 Oct 2022 09:26:29 +0100 Subject: [PATCH] leverage list length knowledge, f-string change --- freqtrade/freqai/data_kitchen.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/freqtrade/freqai/data_kitchen.py b/freqtrade/freqai/data_kitchen.py index ee843b124..e71bddb07 100644 --- a/freqtrade/freqai/data_kitchen.py +++ b/freqtrade/freqai/data_kitchen.py @@ -354,11 +354,12 @@ class FreqaiDataKitchen: :param df: Dataframe to be standardized """ - train_max = [] - train_min = [] - for item in df.keys(): - train_max.append(self.data[item + "_max"]) - train_min.append(self.data[item + "_min"]) + train_max = [None] * len(df.keys()) + train_min = [None] * len(df.keys()) + + for i, item in enumerate(df.keys()): + train_max[i] = self.data[f"{item}_max"] + train_min[i] = self.data[f"{item}_min"] train_max_series = pd.Series(train_max, index=df.keys()) train_min_series = pd.Series(train_min, index=df.keys())