-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DataFrame.eval errors with AttributeError: 'UnaryOp' #16363
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
Comments
I am looking at this as part of the PyCon2017 sprints |
Not really a fix. But if you need a workaround just use float64. |
Using float64 does not work for me, and in any case does not address that attribute Left the sprints early, but looked in to this and realised I don't understand the Pandas Op class behaviour well enough. The problem is that
Seems like incorrect behaviour to me. If I make Does anyone have any thoughts on this? |
I've run the test suite with Any thoughts? |
A smaller version of the original test case is:
Note that it's not just a problem with
|
Agreed. It is not just np.float32 that is causing the trouble. I think that my suggested fix is the correct way forward, having run the full test suite and seen no problems, and thinking about how the design notionally should work. I believe someone got confused with the notion of |
Hi, |
@ksw9 I'll submit a fix for this. That way at least a moderator will have to respond. |
Great, thank you! |
Would it be possible to update this thread if this has been fixed? Thanks again! |
@james-nichols there might be a problem with your approach though. It seems doing your change would completely skip over this section of code which would downcast the type of the unary term to With the silly fix I suggested in #19697 ( Neither though seems to solve #16833. Setting the |
I ran into this recently and would like to help with a patch. As best I can tell, the problem is that I am new to the pandas code, and the expressions code is a bit tricky, but I think we could catch the In short, the problem is that an operation like |
I just wanted to mention that this issue still remains in 0.24.1. I just ran into it. |
best way to fix is to submit a PR there are 2800 other issues |
This issues seems to persist when
tested with pandas v1.2. version infoINSTALLED VERSIONS ------------------ commit : 3e89b4c python : 3.8.6.final.0 python-bits : 64 OS : Darwin OS-release : 20.2.0 Version : Darwin Kernel Version 20.2.0: Wed Dec 2 20:39:59 PST 2020; root:xnu-7195.60.75~1/RELEASE_X86_64 machine : x86_64 processor : i386 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8pandas : 1.2.0 |
I just ran into this. It seems like this ticket is still open and unresolved. I don't totally understand any of the above, but any update would be awesome! |
@SBFRF this was closed a long time ago if u have an issue pls open a new ticket with a reproducible example |
@jreback the 2nd example in the original submission above (same as @sunt05's example) is still broken in Pandas 1.3.5:
If this were my tracker I'd want to keep the context of this ticket instead of opening a new ticket, up to you though. |
@kenahoo there are 3000 issues and very very few people looking at this whom are all volunteers |
@jreback I understand. Just trying to keep the queue informative, and prevent creating issue 3001 if possible, when there's a lot of valuable information already in this existing ticket. Comes down to policy, I guess - if a ticket was mistakenly closed but the code was never actually fixed, do you prefer to re-open it or create a new ticket? |
this is not mistakenly closed |
Jeff, I'm trying to be as helpful as I can possibly be. There were two demonstrated bugs in this ticket. The first case was fixed with a validation test. The second case has not been fixed and still exists in Pandas 1.3.5. We're not really getting anywhere in this ticket, so I'll propose re-opening #16833 instead. Thanks for your time. |
@kenahoo pls don't propose reopening its not going to happen a pull request to fix would be helpful |
Summary: Without this diff, the critical_path_analysis on some traces fails with the error: `'UnaryOp' object has no attribute 'evaluate'` This is apparently a pandas bug: pandas-dev/pandas#16363, which has been solved a few times, but appears in different forms time, and again. Reframing the query is solving the problem in critical_path_analysis for the time being. Differential Revision: D54828775
Summary: Without this diff, the critical_path_analysis on some traces fails with the error: `'UnaryOp' object has no attribute 'evaluate'` This is apparently a pandas bug: pandas-dev/pandas#16363, which has been solved a few times, but appears in different forms time, and again. Reframing the query is solving the problem in critical_path_analysis for the time being. Differential Revision: D54828775
Summary: Without this diff, the critical_path_analysis on some traces fails with the error: `'UnaryOp' object has no attribute 'evaluate'` This is apparently a pandas bug: pandas-dev/pandas#16363, which has been solved a few times, but appears in different forms time, and again. Reframing the query is solving the problem in critical_path_analysis for the time being. Reviewed By: briancoutinho Differential Revision: D54828775
Summary: Pull Request resolved: #112 Without this diff, the critical_path_analysis on some traces fails with the error: `'UnaryOp' object has no attribute 'evaluate'` This is apparently a pandas bug: pandas-dev/pandas#16363, which has been solved a few times, but appears in different forms time, and again. Reframing the query is solving the problem in critical_path_analysis for the time being. Reviewed By: briancoutinho Differential Revision: D54828775 fbshipit-source-id: 0bb52d1da7b5b143949c464b453955a666d31581
Code Sample, a copy-pastable example if possible
Problem description
This is related to #11235.
on python 3.6, pandas 20.1, this raises an error the traceback ends with:
In that case the right is -(0.1)
pandas: 0.20.1
pytest: None
pip: 9.0.1
setuptools: 27.2.0
Cython: 0.25.2
numpy: 1.12.1
scipy: 0.19.0
xarray: None
IPython: 6.0.0
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
pandas_gbq: None
pandas_datareader: None
Another example:
The text was updated successfully, but these errors were encountered: