@@ -101,7 +101,9 @@ def __call__(self, *args, **kwargs):
101101 return obj
102102
103103
104- def _default_parameters (function , function_prefix : str = "" , start_index : int = 1 ):
104+ def _default_parameters (
105+ function , function_prefix : str = "function." , start_index : int = 1
106+ ):
105107 sig = inspect .signature (function )
106108 defaults = {
107109 f"{ function_prefix } { k } " : v .default
@@ -111,13 +113,20 @@ def _default_parameters(function, function_prefix: str = "", start_index: int =
111113 return defaults
112114
113115
114- def assign_defaults (function , df , function_prefix : str = "" , start_index : int = 1 ):
116+ def assign_defaults (
117+ function , df , function_prefix : str = "function." , start_index : int = 1
118+ ):
115119 defaults = _default_parameters (function , function_prefix , start_index )
116120 for k , v in defaults .items ():
117121 df [k ] = len (df ) * [v ]
118122
119123
120- def partial_function_from_dataframe (function , df , function_prefix : str = "" ):
124+ def partial_function_from_dataframe (function , df , function_prefix : str = "function." ):
125+ if function_prefix == "" :
126+ raise ValueError (
127+ "The function_prefix cannot be an empty string because"
128+ " it is used to distinguish between function and learner parameters."
129+ )
121130 kwargs = {}
122131 for col in df .columns :
123132 if col .startswith (function_prefix ):
0 commit comments