(I think) I've discovered that the statsmodels module (or at least the part I'm using, see example below) cannot handle Pandas' nullable Int64 data type. Below is a small (though I doubt minimal) working example.
This works fine:
import statsmodels.formula.api as smf
import pandas as pd
x= pd.DataFrame([[1,2,3],[4,5,6],[7,8,9]], columns=['a','b','c'])
mod = smf.ols(formula = 'a ~ b + c', data = x)
# worked just fine. data types are (non-nullable) int64's
But this doesn't:
import statsmodels.formula.api as smf
import pandas as pd
x= pd.DataFrame([[1,2,3],[4,5,6],[7,8,9]], columns=['a','b','c'])
x = x.convert_dtypes()
mod = smf.ols(formula = 'a ~ b + c', data = x)
# now an error: TypeError: Cannot interpret 'Int64Dtype()' as a data type
Is my inference correct? If so, is there a best (or at least slick) workaround?
statsmodels version: 0.12.2 pandas version: 1.1.5