Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spyder console not showing output

Tags:

python

spyder

I run the following code in Spyder 4.1.1 but the console doesn't show any output :

df.head()
df.shape

Previously I had Spyder 3.7 and it worked but now after updating it is not working. I tried resetting to default settings and tried to change the console settings but nothing worked. If I used print(df.head) it works but it should work without print().

Please help. Attached is the screenshot

spyder screenshot

like image 843
Musab Ahmad Avatar asked Apr 01 '20 13:04

Musab Ahmad


People also ask

How do I reset my Spyder Console?

The shortcut key for commenting and uncommenting in Spyder is Ctrl + 1 (Click Ctrl and 1 simultaneously). For both Python shell and IPython shell, they have command history through the arrow key. Clicking the up arrow key will show previously typed commands. To clear the output on Console, use Ctrl-L.

How do you debug a Spyder function?

Spyder's debugger is integrated with the Breakpoints pane, which lists the file, line, and condition (if any) of every breakpoint defined. To open it, select Debug ‣ List breakpoints, or press Ctrl - Shift - B ( Cmd - Shift - B on macOS).


Video Answer


2 Answers

Try running the following in the Ipython console.

%config InteractiveShell.ast_node_interactivity='last_expr'

This is the setting description:

ZMQInteractiveShell.ast_node_interactivity=<Enum>

Current: 'last_expr'
Choices: ['all', 'last', 'last_expr', 'none', 'last_expr_or_assign']

'all', 'last', 'last_expr' or 'none', 'last_expr_or_assign' specifying which 
nodes should be run interactively (displaying output from expressions).
like image 190
Ardweaden Avatar answered Sep 18 '22 11:09

Ardweaden


You need to highlight what you want to run. Then run/execute the current line/s by either pressing F9, or the Run selection or current line button on the Run toolbar(the black one). It will then show output without needing to use print

like image 28
Paddy Popeye Avatar answered Sep 21 '22 11:09

Paddy Popeye