Closed nursimaaigoritma closed 8 months ago
@nursimaaigoritma Sorry for the trouble. I think I understand and can fix the problem. The "handle comparison(s) operator" code (which is what a > b
uses) also handles multiple chained comparisons (a > b > c
), and we want a way to check for False values as we go to short-circuit unneeded tests. So for each, we check whether we can just test the truth value of the result. But: there is an explicit check for numpy arrays, which will also have an array of bools and we do not check the truth value of these. Of course, pandas Dataframes are not numpy arrays, so that test of "should we not try to short-circuit this value" fails.
I think the right solution is not to check whether it is a numpy array (it will miss other sequence objects too), but to just try to check whether the value so far agrees with "not True", and break then.
I hope to push a fix to GitHub today. If you're OK with installing from GH master branch, I may not push a release for this immediately...
@nursimaaigoritma I think this is now fixed in the master branch, though I have not added a test for this case yet.
Thank you so much! I'll try getting it from the master branch.
Hello,
I want to compare pandas Series, like
But it gives me this error
The line
print(df.a > df.b)
works fine with the output:Is there something I'm doing wrong? Thank you.