Skip to content

'numexpr' - how to find a pandas supported version? #2

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

Closed
SophMC opened this issue May 4, 2016 · 5 comments
Closed

'numexpr' - how to find a pandas supported version? #2

SophMC opened this issue May 4, 2016 · 5 comments
Assignees

Comments

@SophMC
Copy link
Owner

SophMC commented May 4, 2016

@aaren
I believe the pandas function query() could be very useful for me, but when I try to use it, I get this error
wind.query('year' > 1986 and 'year' < 1999)

ImportError: 'numexpr' is not installed or an unsupported version. Cannot use engine='numexpr' for query/eval if 'numexpr' is not installed

The documentation here says:
"numexpr: for accelerating certain numerical operations. numexpr uses multiple cores as well as smart chunking and caching to achieve large speedups. If installed, must be Version 2.1 or higher (excluding a buggy 2.4.4). Version 2.4.6 or higher is highly recommended."

It IS installed - version 2.5.

So, is pandas not trained to use 2.5? I believe there are some clues in this discussion, but I don't follow what they are saying.

Should I install a different version of numexpr? or accept that pd.query() is beyond my grasp :(

p.s. I updated my whole anaconda distribution, but I still only have 0.18.0. I think 0.18.1 was only released on 3rd May 2016.

@SophMC
Copy link
Owner Author

SophMC commented May 4, 2016

I've also tried adding parser = 'python', engine = 'python, engine = 'numexpr' but to no avail:

wind.query('year' > 1986 and 'year' < 1999, parser='python')

@SophMC SophMC self-assigned this May 5, 2016
@aaren
Copy link

aaren commented May 6, 2016

If you do wind.query('year' > 1986, engine='python') what error do you get?

@SophMC
Copy link
Owner Author

SophMC commented May 6, 2016

Very strange. I'm not getting the numexpr ImportError at all now.
To answer your question:
wind.query('year' > 1986, engine='python') #KeyError: True

Some other variations:
wind.query('year' > 1986 or 'year' < 1999)# KeyError: True

`wind.query('year' > 1986 and 'year' < 1999)# KeyError: False``

wind.query('year' > 1986 or 'year' < 1999, engine='python')# KeyError: True

The documentation here suggests that the following two should give the same result. But they don't.
wind.query('year' > 1986) #KeyError: True
wind[wind.year > 1986]
date_time year month day hour ws
2593 1987-01-01 06:00:00 1987 1 1 6 5.82639
2594 1987-01-01 12:00:00 1987 1 1 12 7.30782
2595 1987-01-01 18:00:00 1987 1 1 18 5.05220
2596 1987-01-02 06:00:00 1987 1 2 6 5.23692
2597 1987-01-02 12:00:00 1987 1 2 12 6.36581
2598 1987-01-02 18:00:00 1987 1 2 18 4.72313
2599 1987-01-03 06:00:00 1987 1 3 6 3.67479
2600 1987-01-03 18:00:00 1987 1 3 18 3.77146
2601 1987-01-04 06:00:00 1987 1 4 6 4.40437
2602 1987-01-04 18:00:00 1987 1 4 18 4.06409

@aaren
Copy link

aaren commented May 6, 2016

Your expression needs to be a string.

wind.query("year > 1986 or year < 1999")

@SophMC
Copy link
Owner Author

SophMC commented May 6, 2016

Thank you. I still don't understand what happened with ImportError at the beginning, but it doesn't matter now!

@SophMC SophMC closed this as completed May 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants