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

Allow sm.OLS to work with Float64 values #8982

Open
marcdelabarrera opened this issue Aug 22, 2023 · 1 comment
Open

Allow sm.OLS to work with Float64 values #8982

marcdelabarrera opened this issue Aug 22, 2023 · 1 comment

Comments

@marcdelabarrera
Copy link

When working with Float64 values form pandas, sm.OLS raises an error

ValueError: Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).

Example

impor pandas as pd
import statsmodels.api as sm
x = pd.Series([1,2,3,4]).astype('Float64')
y = pd.Series([1,2,3,4]).astype('Float64')
sm.OLS(y,x).fit()

It is easy to convert the Float64 into a float64 value, but it would be nice if sm.OLS can handle that.

@bashtage
Copy link
Member

There is no support for extension arrays. While in your case it is simple to convert, how should pd.NA and np.nan be handled in an array that contained these?

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