Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

2d errors when passing pandas DataFrame/Series #149

Open
simpsus opened this issue Feb 23, 2021 · 0 comments
Open

2d errors when passing pandas DataFrame/Series #149

simpsus opened this issue Feb 23, 2021 · 0 comments

Comments

@simpsus
Copy link

simpsus commented Feb 23, 2021

training is a pd.DataFrame
features is a list of column names

model = AdaGradRegressor()
model.fit(training[features], training['target'])
throws
~\Anaconda3\envs\numerai\lib\site-packages\lightning\impl\adagrad.py in fit(self, X, y)
130 def fit(self, X, y):
131 self.outputs_2d_ = len(y.shape) > 1
--> 132 Y = y.reshape(-1, 1) if not self.outputs_2d_ else y
133 Y = Y.astype(np.float64)
134 return self._fit(X, Y)

~\Anaconda3\envs\numerai\lib\site-packages\pandas\core\generic.py in getattr(self, name)
5137 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5138 return self[name]
-> 5139 return object.getattribute(self, name)
5140
5141 def setattr(self, name: str, value) -> None:

AttributeError: 'Series' object has no attribute 'reshape'

when I pass training['target'].values it works.
My normal scikit-learn workflow is to pass the pandas objects and that never is an issue.

model.predict(training[features]) has the same issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant