@@ -214,7 +214,7 @@ def filter_features(
214
214
self ,
215
215
unfiltered_df : DataFrame ,
216
216
training_feature_list : list ,
217
- label_list : list = list () ,
217
+ label_list : list | None = None ,
218
218
training_filter : bool = True ,
219
219
) -> tuple [DataFrame , DataFrame ]:
220
220
"""
@@ -244,7 +244,7 @@ def filter_features(
244
244
# we don't care about total row number (total no. datapoints) in training, we only care
245
245
# about removing any row with NaNs
246
246
# if labels has multiple columns (user wants to train multiple modelEs), we detect here
247
- labels = unfiltered_df .filter (label_list , axis = 1 )
247
+ labels = unfiltered_df .filter (label_list or [] , axis = 1 )
248
248
drop_index_labels = pd .isnull (labels ).any (axis = 1 )
249
249
drop_index_labels = (
250
250
drop_index_labels .replace (True , 1 ).replace (False , 0 ).infer_objects (copy = False )
@@ -654,8 +654,8 @@ def get_pair_data_for_features(
654
654
pair : str ,
655
655
tf : str ,
656
656
strategy : IStrategy ,
657
- corr_dataframes : dict = {} ,
658
- base_dataframes : dict = {} ,
657
+ corr_dataframes : dict ,
658
+ base_dataframes : dict ,
659
659
is_corr_pairs : bool = False ,
660
660
) -> DataFrame :
661
661
"""
@@ -773,10 +773,10 @@ def populate_features(
773
773
def use_strategy_to_populate_indicators ( # noqa: C901
774
774
self ,
775
775
strategy : IStrategy ,
776
- corr_dataframes : dict = {} ,
777
- base_dataframes : dict = {} ,
776
+ corr_dataframes : dict [ str , DataFrame ] | None = None ,
777
+ base_dataframes : dict [ str , dict [ str , DataFrame ]] | None = None ,
778
778
pair : str = "" ,
779
- prediction_dataframe : DataFrame = pd . DataFrame () ,
779
+ prediction_dataframe : DataFrame | None = None ,
780
780
do_corr_pairs : bool = True ,
781
781
) -> DataFrame :
782
782
"""
@@ -793,6 +793,10 @@ def use_strategy_to_populate_indicators( # noqa: C901
793
793
:return:
794
794
dataframe: DataFrame = dataframe containing populated indicators
795
795
"""
796
+ if not corr_dataframes :
797
+ corr_dataframes = {}
798
+ if not base_dataframes :
799
+ base_dataframes = {}
796
800
797
801
# check if the user is using the deprecated populate_any_indicators function
798
802
new_version = inspect .getsource (strategy .populate_any_indicators ) == (
@@ -822,7 +826,7 @@ def use_strategy_to_populate_indicators( # noqa: C901
822
826
if tf not in corr_dataframes [p ]:
823
827
corr_dataframes [p ][tf ] = pd .DataFrame ()
824
828
825
- if not prediction_dataframe .empty :
829
+ if prediction_dataframe is not None and not prediction_dataframe .empty :
826
830
dataframe = prediction_dataframe .copy ()
827
831
base_dataframes [self .config ["timeframe" ]] = dataframe .copy ()
828
832
else :
0 commit comments