Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: OLS.predict() - cast input to DataFrame from Series before performing operations #5234

Closed
wants to merge 2 commits into from

Conversation

rockg
Copy link
Contributor

@rockg rockg commented Oct 15, 2013

Closes #5233. Simply cast to a Series to a DataFrame before dropping NAs or filling.

@jreback
Copy link
Contributor

jreback commented Oct 15, 2013

can u add some tests that demonstrate the issue?

@jtratner
Copy link
Contributor

Frankly, I think the better fix (separate from this PR) would be to have Series' dropna match signature of DF and Panel, since both 'any' and 'all' or thresh apply. Just means that you don't have to care about what kind of NDFrame you have.

Please update your commit message to emphasize that it's only in OLS-Predict. I read the title and was quite confused.

@jreback jreback mentioned this pull request Oct 16, 2013
7 tasks
@rockg
Copy link
Contributor Author

rockg commented Oct 16, 2013

@jreback @jtratner Here is the issue demonstrated and I put this as a test in the last commit that now passes with the fix. I agree with @jtratner that series and dataframes should have the same drop arguments.

y = tm.makeTimeSeries()
x = tm.makeTimeSeries()
model = ols(y=y, x=x)
model.predict(x=x)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File ...ols.py, line 446, in predict
    x = x.dropna(how='any')
TypeError: dropna() got an unexpected keyword argument 'how'

@jtratner
Copy link
Contributor

looks fine to me.

@jreback
Copy link
Contributor

jreback commented Oct 17, 2013

closing in favor of #5251 (credited for your tests!)

@rockg rockg deleted the patch-1 branch March 11, 2014 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: OLS.predict() fails when given a Series
3 participants