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
Numexpr not found in pandas
提问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.1
and numexpr
: I am not sure what numexpr version I used, but used it yesterday at home with numpy 1.10.1
under python 3.4
and it worked.
关于你提到的有关的兼容性最后的评论numpy 1.10.1
和numexpr
:我不知道我用什么numexpr版本,但昨天与使用在家里numpy 1.10.1
下python 3.4
,它的工作。
I am not an expert in using pip
so maybe my hint is wrong but when I used pip
to upgrade numpy
under Ubuntu lately it updated only numpy
for python 2.7
which is installed in parallel on my machine.
我不是使用专家,pip
所以也许我的提示是错误的,但是当我最近在 Ubuntu 下pip
升级时numpy
,它只更新numpy
了python 2.7
在我的机器上并行安装的内容。
As I use python 3.4
for coding I had to install pip3
to 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'