pandas.core.config.OptionError: "没有这样的键:'display.unicode.east_asian_width'"
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37175719/
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
pandas.core.config.OptionError: "No such keys(s): 'display.unicode.east_asian_width'"
提问by Ke Tian
I want to make the printed result of my python code be aligned properly.
although I have got the suggestion by the @jezrael in the stack overflow, and added the following code:
我想让我的 python 代码的打印结果正确对齐。
虽然我在堆栈溢出中得到了@jezrael 的建议,并添加了以下代码:
pd.set_option('display.unicode.east_asian_width', True).
Please see the question which I have posted in this site: Python Pandas: print the csv data in oder with columns
请参阅我在本网站上发布的问题:Python Pandas: print the csv data in oder with columns
Although it works in vagrant (python 3 version) and emac environment, but I can't work in the terminal environment (python 2 version) and the error is printed:
虽然在vagrant(python 3版本)和emac环境下都可以工作,但是在终端环境(python 2版本)下就不行了,报错:
pandas.core.config.OptionError: "No such keys(s): 'display.unicode.eat_asian_width'
taka-no-MacBook-Pro:Desktop tianke0711$ python test_plot.py
Traceback (most recent call last):
File "test_plot.py", line 8, in <module>
pd.set_option('display.unicode.east_asian_width', True)
File "//anaconda/lib/python2.7/site-packages/pandas/core/config.py", line 222, in __call__
return self.__func__(*args, **kwds)
File "//anaconda/lib/python2.7/site-packages/pandas/core/config.py", line 119, in _set_option
key = _get_single_key(k, silent)
File "//anaconda/lib/python2.7/site-packages/pandas/core/config.py", line 83, in _get_single_key
raise OptionError('No such keys(s): %r' % pat)
pandas.core.config.OptionError: "No such keys(s):
'display.unicode.eat_asian_width'
I don't know how to solve it, please give me your hand, thanks!
不知道怎么解决,求大神指点,谢谢!
采纳答案by Ke Tian
Since the python version is different. More, the different version of python have different version of pandas. The python 2.7 which I have used currently has the pandas:0.16.2, and this version of pandas has not No such keys(s): 'display.unicode.at_asian_width', and cause the error. However, the version of pandas:pandas-0.18.1 support this.
由于python版本不同。而且,不同版本的python有不同版本的pandas。我目前使用的python 2.7有pandas:0.16.2,这个版本的pandas没有这样的键:'display.unicode.at_asian_width',并导致错误。但是,pandas:pandas-0.18.1 的版本支持这个。
Two solution, 1. use the python3 version 2. update pandas:conda install pandas=0.18.1 in python 2. But when you want to install the latest version of pandas, there is error : The following specifications were found to be in conflict:mayavi
两种解决方案,1.使用python3版本 2.更新pandas:conda install pandas=0.18.1 in python 2.但是当你想安装最新版本的pandas时,出现错误:发现以下规范冲突:mayavi
firstly, conda uninstall mayavi, and then conda install pandas=0.18.1, it works. Thanks!
首先,conda 卸载mayavi,然后conda install pandas=0.18.1,就可以了。谢谢!