Joshua-Data-Wizard / PyRealEstate

Creating a Library to help in the development and evaluation of real estate AVM's
MIT License
0 stars 1 forks source link

problems with pandas and statsmodels #4

Closed kdschlosser closed 1 year ago

kdschlosser commented 1 year ago

There are some issues in your code that will have to be fixed. Specifically in the RealEstateMetrics.py file. pandas has removed the ability to access columns using index numbers so the line of code below no longer work using a newer version of pandas

lines that look like this

        rtn = reg.conf_int(alpha=0.05, cols=None)[1, 0]

need to be changed to

    rtn =  reg.conf_int(alpha=0.05, cols=None).iloc(1)[0]

and lines that look like this

            rtn = reg.params[1]

need to be changed to

      rtn =  reg.params.iloc[1]

I am not sure if the pvalues attribute existed in earlier versions of statsmodels but that attribute is not available in newer versions. I believe what you are wanting is the f_pvalue attribute.

so lines that look like this

if reg.pvalues[1] < 0.05:

need to be changed to

if reg.f_pvalue < 0.05:

That is for the latest version of pandas and statsmodels running on Python 3.11

let me know if you want me to make the modifications and submit a PR for them. If not I need to know exactly what versions of pandas and statsmodels you are using so those version can be added to the project requirements to avoid things not working right.

kdschlosser commented 1 year ago

I also recommend pushing the minimum required version of python from 3.4 to at least 3.6 better would be 3.11since all lower versions are end of life and are no longer going to be updated. 3.11 is marked to become EOL in 5 months.

Joshua-Data-Wizard commented 1 year ago

Good Evening, thanks for pointing this out I really appreciate it!! I can take care of these changes I will try and get them implemented today or tomorrow!

kdschlosser commented 1 year ago

no worries. glad to help.

Joshua-Data-Wizard commented 1 year ago

Good Morning! So I was looking into this more closely and I don't think we will need to actually make any changes since in RealEstateMetrics it uses numpy arrays and not pandas data frames so iloc is not need. I just wanted to make sure that it also makes sense to you. I did update the minimum requirements for Python in the cfg and toml files and committed the changes to main!