zzhengnan
zzhengnan

Reputation: 415

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.

Upvotes: 12

Views: 24113

Answers (3)

user13986286
user13986286

Reputation: 21

I just added the below library then it works

from IPython.display import display

display()

Upvotes: 0

Rohini
Rohini

Reputation: 376

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

Upvotes: 36

Jourdans
Jourdans

Reputation: 53

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

Upvotes: 3

Related Questions