pandas 新分配的变量未显示在 Spyder 的变量资源管理器中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31526983/
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
Newly-assignmed variables not showing up in Spyder's variable explorer
提问by Nero
I'm writing Python on Spyder. Please see my code below:
我正在 Spyder 上编写 Python。请看我下面的代码:
import pandas as pd
data = pd.io.excel.read_excel('Data.xls')
CMT_column = data['CMT']
"data" contains a column called "CMT." What I'm trying to do is create a variable called "CMT_column" that contains the values of the "CMT" column.
“数据”包含一个名为“CMT”的列。我想要做的是创建一个名为“CMT_column”的变量,其中包含“CMT”列的值。
Here's the problem. After I run the code, only "data" appears in the variable explorer. "CMT_column" is not there. But if I call "CMT_column" in the IPython console, it shows the values of "CMT" as expected. So I guess the variable has been created after all, but why is it not visible in the variable explore?
这就是问题所在。运行代码后,变量资源管理器中仅出现“数据”。“CMT_column”不存在。但是,如果我在 IPython 控制台中调用“CMT_column”,它会按预期显示“CMT”的值。所以我猜变量毕竟已经创建了,但是为什么它在变量 explore 中不可见?
Thanks in advance for any help.
在此先感谢您的帮助。
回答by Rohini
Go to Variable explorer window.
转到变量资源管理器窗口。
Then you have options button right hand side.
然后你有选项按钮右侧。
Click on it,Untick the option Exclude all uppercase preferences as shown in image.
单击它,取消选中排除所有大写首选项选项,如图所示。


回答by Jourdans
It seems that Spyder's variable explorer does not like variables with upper case: try rewriting CMT_ as cmt_.
似乎 Spyder 的变量资源管理器不喜欢大写的变量:尝试将 CMT_ 重写为 cmt_。

