MilesCranmer commited on
Commit
555ddd0
1 Parent(s): 8d9d5f3

Fix callables when feature importance AND pandas used

Browse files
Files changed (1) hide show
  1. pysr/sr.py +3 -3
pysr/sr.py CHANGED
@@ -239,9 +239,9 @@ class CallableEquation:
239
 
240
  def __call__(self, X):
241
  if isinstance(X, pd.DataFrame):
242
- X = np.array(X[self._variable_names])
243
-
244
- if self._selection is not None:
245
  return self._lambda(*X[:, self._selection].T)
246
  return self._lambda(*X.T)
247
 
 
239
 
240
  def __call__(self, X):
241
  if isinstance(X, pd.DataFrame):
242
+ # Lambda function takes as argument:
243
+ return self._lambda(**{k: X[k].values for k in X.columns})
244
+ elif self._selection is not None:
245
  return self._lambda(*X[:, self._selection].T)
246
  return self._lambda(*X.T)
247