pandas 在熊猫中找不到 Numexpr

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33909782/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 00:16:11  来源:igfitidea点击:

Numexpr not found in pandas

pythonpandasnumexpr

提问by Anton Protopopov

I install numexpr package via pip on my Windows 7 machine:

我通过 pip 在我的 Windows 7 机器上安装 numexpr 包:

pip list | grep numexpr
numexpr (2.4.6)

but when I open ipython and trying to use df.queryit shows an error:

但是当我打开 ipython 并尝试使用df.query 时,它显示了一个错误:

ImportError: 'numexpr' not found. Cannot use engine='numexpr' for query/eval if 'numexpr' is not installed

Than I checked whether it installed or not with pd.show_versions:

比我检查它是否安装与 pd.show_versions 相比:

In [97]: pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 3.4.3.final.0
python-bits: 32
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 37 Stepping 5, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.17.1
nose: None
pip: 7.1.2
setuptools: 18.5
Cython: None
numpy: 1.10.1
scipy: 0.16.1
statsmodels: 0.6.1
IPython: 4.0.0
sphinx: None
patsy: 0.4.1
dateutil: 2.4.2
pytz: 2015.7
blosc: None
bottleneck: 1.0.0
tables: None
numexpr: None
matplotlib: 1.5.0
openpyxl: 2.3.1
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: None
lxml: 3.5.0
bs4: 4.4.1
html5lib: 1.0b8
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
Jinja2: 2.8

From the docs:

文档

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.

numexpr:用于加速某些数值运算。numexpr 使用多个内核以及智能分块和缓存来实现大幅加速。如果安装,必须是版本 2.1 或更高版本

回答by MrCyclophil

Regarding your last comment about compatibility of numpy 1.10.1and numexpr: I am not sure what numexpr version I used, but used it yesterday at home with numpy 1.10.1under python 3.4and it worked.

关于你提到的有关的兼容性最后的评论numpy 1.10.1numexpr:我不知道我用什么numexpr版本,但昨天与使用在家里numpy 1.10.1python 3.4,它的工作。

I am not an expert in using pipso maybe my hint is wrong but when I used pipto upgrade numpyunder Ubuntu lately it updated only numpyfor python 2.7which is installed in parallel on my machine.

我不是使用专家,pip所以也许我的提示是错误的,但是当我最近在 Ubuntu 下pip升级时numpy,它只更新numpypython 2.7在我的机器上并行安装的内容。

As I use python 3.4for coding I had to install pip3to get it also upgraded for python3. Try if the installation works when using pip3 install numexpr.

当我python 3.4用于编码时,我必须安装pip3才能将其升级为python3. 使用pip3 install numexpr.

回答by kmtomile

Since the 'numexpr' engine can not be found use the 'python' engine instead. Open the eval.py file in pandas package and replace the

由于找不到“numexpr”引擎,请改用“python”引擎。打开 pandas 包中的 eval.py 文件并替换

def eval(expr, parser='pandas', engine='numexpr'

with

def eval(expr, parser='pandas', engine='python'