Sorry for this noob question. I recently installed Anaconda Spyder UI for Python on MacOS. Within Spyder you see three windows, the python file (source code), the variable explorer and the IPython console.
I got two problems:
First, the shortcuts do not work. For instance: Run Cell = CTRL+ENTER and Run Cell and Advance is SHIFT+ENTER. But does not work.
Second, the output of the IPython console does not work. Let's assume the following code:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Data.csv')
x = dataset.iloc[:, :-1].values
y = dataset.iloc[:, 3].values
x
Then the last line should print x as output onto the IPython console. But instead I get only this:
In [1]: runfile('/Users/guest/Development/data.py',
wdir='/Users/guest/Development/')
And no Out [1]. Question: What am I doing wrong? I couldn't locate anything in the preferences dialog.
Best Answer
#%%
to break your files in cells, which are blocks of code you can evaluate independently. Then Cmd+Enter and Shift+Enter will work as expected, i.e. they will evaluate the current cell and stay on it or move to the next one, respectively.print(x)
, because Run doesn't print by default.