Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Newly-assignmed variables not showing up in Spyder's variable explorer

I'm writing Python on Spyder. Please see my code below:

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.

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?

Thanks in advance for any help.

like image 407
zzhengnan Avatar asked Jul 20 '15 21:07

zzhengnan


People also ask

How do you refresh a variable Explorer in Spyder?

Refresh while code is running To trigger a refresh, simply click the reload button on the Variable Explorer toolbar, or press the shortcut Ctrl+R ( Cmd-R ) when it has focus.

How do you show variable in Spyder Explorer?

Go to View/Panes and select Variable Explorer. Save this answer. Show activity on this post. Save this answer.

How do you show variables in Spyder Python?

To see them all, double click the list to open a viewer that will display the index, type, size and value of each element of the list. Just like dictionaries, you can double-click values to edit them.

What is variable Explorer in Spyder?

The Variable Explorer shows the namespace contents (all global object references, such as variables, functions, modules, etc.) of the currently selected IPython Console session, and allows you to interact with them through a variety of GUI-based editors.


2 Answers

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.

Image

like image 153
Rohini Avatar answered Oct 22 '22 10:10

Rohini


It seems that Spyder's variable explorer does not like variables with upper case: try rewriting CMT_ as cmt_.

like image 35
Jourdans Avatar answered Oct 22 '22 10:10

Jourdans