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

Option to avoid MissingValueWarning warning. #531

Open
marcdelabarrera opened this issue May 23, 2023 · 3 comments
Open

Option to avoid MissingValueWarning warning. #531

marcdelabarrera opened this issue May 23, 2023 · 3 comments
Assignees

Comments

@marcdelabarrera
Copy link

Currently, it seems there is no way to avoid the MissingValueWarning when initializing a IV2SLS (and I guess any parent of it). It would be nice to have the option to avoid this warning, since if one uses operators like shift, it inevitably induces missing values in the formula. I know it and I want them to be dropped.

The current solution is:

import warnings
from linearmodels.shared.exceptions import MissingValueWarning
warnings.filterwarnings("ignore", category=MissingValueWarning)

but it would be nice to have a missing option like statsmodels OLS.

@bashtage
Copy link
Owner

I think the only practical way to disable this would require an options structure similar to what pandas does. Something like

from linear models import options, options_manager

# Permanent, until switched
options.warn_on_missing = False
# or, temporarily
with options_manager(warn_on_missing=False):
   PanelOLS(...)

@bashtage
Copy link
Owner

Alternatively, you could call dropna on your DataFrame.

@marcdelabarrera
Copy link
Author

Thx. dropna in the DataFrame does not work if I use .shift() in the formula since it introduces na values even with a dataset without na. the options make sense and I don't have to use warnings. It would be great to have it as an option when creating the instance IV2SLS.

@bashtage bashtage self-assigned this Sep 21, 2023
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

No branches or pull requests

2 participants