statsmodels.api returning MissingDataError: exog contains inf or nans when trying to fit multivariate regression

We Are Going To Discuss About statsmodels.api returning MissingDataError: exog contains inf or nans when trying to fit multivariate regression. So lets Start this Python Article.

statsmodels.api returning MissingDataError: exog contains inf or nans when trying to fit multivariate regression

  1. How to solve statsmodels.api returning MissingDataError: exog contains inf or nans when trying to fit multivariate regression

    I am not so sure how you conclude there's no na values, if you look at your table:
    x_multi_cons.isna().sum() [...] n_hos_beds 8 [...]
    This means there are 8 missing values for n_hos_beds . If it doesn't hurt you model, just remove the nans at the start:
    df = df.dropna()

  2. statsmodels.api returning MissingDataError: exog contains inf or nans when trying to fit multivariate regression

    I am not so sure how you conclude there's no na values, if you look at your table:
    x_multi_cons.isna().sum() [...] n_hos_beds 8 [...]
    This means there are 8 missing values for n_hos_beds . If it doesn't hurt you model, just remove the nans at the start:
    df = df.dropna()

Solution 1

I am not so sure how you conclude there’s no na values, if you look at your table:

x_multi_cons.isna().sum()

[...]
n_hos_beds                  8
[...]

This means there are 8 missing values for n_hos_beds . If it doesn’t hurt you model, just remove the nans at the start:

df = df.dropna()

Original Author StupidWolf Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment