@@ -101,7 +101,9 @@ def __call__(self, *args, **kwargs):
101
101
return obj
102
102
103
103
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
+ ):
105
107
sig = inspect .signature (function )
106
108
defaults = {
107
109
f"{ function_prefix } { k } " : v .default
@@ -111,13 +113,20 @@ def _default_parameters(function, function_prefix: str = "", start_index: int =
111
113
return defaults
112
114
113
115
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
+ ):
115
119
defaults = _default_parameters (function , function_prefix , start_index )
116
120
for k , v in defaults .items ():
117
121
df [k ] = len (df ) * [v ]
118
122
119
123
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
+ )
121
130
kwargs = {}
122
131
for col in df .columns :
123
132
if col .startswith (function_prefix ):
0 commit comments