You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think what is happening is that patsy is decoding integers as 1L, 2L, 3L, 4L, and 5L on the failing test cases, while it is just 1, 2, 3, 4, and 5 on the passing ones. Thus, you'd need to set the constraint as 'C(agecat)[T.5L] = C(agecat)[T.4L]' to pass the 2.7 case. Of course, that will break the other, currently working cases.
Perhaps we could change the variables to be strings or floats so the L doesn't get added? Happy to play with this if someone has an idea.
It's the first time that I saw it today in your PR.
If it shows up more often or regularly now, then I'll investigate. Right now I have no idea what might have changed. Those tests are a few years old.
Names are created within patsy, so we don't control them. If we have to, then we need to adjust the tests if the names that patsy creates change by operating system or version as you point out as source of the problem. (maybe just a change in the dtype of the integers works.)
Thanks @thequackdaddy. It's possible this is due to pandas-dev/pandas#17491, where iterating over a pandas DataFrame always returns a python scalar (instead of a NumPy 0d scalar). I suspect that (again, may be wrong), since AFAICT, NumPy doesn't have a "long" integer, so those must be coming from Python? Does statsmodels iterate over the DataFrame (maybe calling .tolist) anywhere? Or would that be in Patsy?
Activity
[-]test_discrete fail[/-][+]test_constrained fail[/+]josef-pkt commentedon Nov 7, 2017
It's the first time that I saw it today in your PR.
If it shows up more often or regularly now, then I'll investigate. Right now I have no idea what might have changed. Those tests are a few years old.
Names are created within patsy, so we don't control them. If we have to, then we need to adjust the tests if the names that patsy creates change by operating system or version as you point out as source of the problem. (maybe just a change in the dtype of the integers works.)
josef-pkt commentedon Nov 7, 2017
and thanks for checking
When I looked at those failures earlier today, I had no clue what might be going on.
thequackdaddy commentedon Nov 7, 2017
I think the difference is pandas updated to 0.21...
this passes
This fails...
josef-pkt commentedon Nov 7, 2017
does converting the data in the test module to a numpy.int64 dtype work?
@TomAugspurger did the internal int representation change in pandas 0.21?
TomAugspurger commentedon Nov 7, 2017
Nothing major like that. I'm unfortunately not able to reproduce on my Mac.
thequackdaddy commentedon Nov 7, 2017
So this is some weird patsy/pandas thing... don't fully understand it... I can't get it to show up on pandas 0.21 on python 3.6.
Here's the "expected" behavior.
Here's the "weird" behavior.
Notice the addition of the "L" in the patsy dmatrix in the "weird" one.
TomAugspurger commentedon Nov 7, 2017
Thanks @thequackdaddy. It's possible this is due to pandas-dev/pandas#17491, where iterating over a pandas DataFrame always returns a python scalar (instead of a NumPy 0d scalar). I suspect that (again, may be wrong), since AFAICT, NumPy doesn't have a "long" integer, so those must be coming from Python? Does statsmodels iterate over the DataFrame (maybe calling
.tolist) anywhere? Or would that be in Patsy?josef-pkt commentedon Nov 7, 2017
It's patsy that has to loop over the unique values to create the name for the categorical variables or dummy variables and I guess uses repr or str.