Reputation: 334
I am trying to import a dataset from the UCLA repository. I was able to do it succesfully in Jupyter Notebook but when I am trying to do the same in Spyder, I get no output. The code I have used is this:
import pandas as pd
url = "https://archive.ics.uci.edu/ml/machine-learning-databases/autos/imports-
85.data"
df = pd.read_csv(url)
df.head(20)
So, in Jupyter, I got the first 20 rows of the dataset on executing these steps but when I press the same in Sypder, nothing comes out as output. I did some digging around and found out that you got to change the forward slashes to backward slashes in Windows but even after doing that, nothing changes. I will really appreciate it if anyone can point out what it is I am doing wrong.
Thanks!
Upvotes: 0
Views: 743
Reputation: 694
When you write the code in Spyder's editor window, Spyder will run the code in a batch way, so you need to add the print() statement to get output.
print(df.head(20))
You should however get the correct output, if you run the original command manually in Spyder's iPython window.
Upvotes: 2