Dukakus17
Dukakus17

Reputation: 1249

python file does not run properly on Spyder

I am using Spyder as my python IDE.

I tried run this python code:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os

path = os.getcwd() + '\ex1data1.txt'
data = pd.read_csv(path, header = None, names = ['Population', 'Profit'])
data.head()

In theory it is supposed to show me a table of data since I am using

data.head()

at the end

but when I run it, it only shows :

enter image description here

I thought it was supposed to display a new window with the data table.

What is wrong?

Upvotes: 0

Views: 204

Answers (2)

Arun Kumar Khattri
Arun Kumar Khattri

Reputation: 1628

You want to print your data.head() so do that... print(data.head())

Upvotes: 1

voidpro
voidpro

Reputation: 1672

You are calling data.head() in .py script. The script is supposed to only read the data, not print it. Try print(data.head())

Upvotes: 2

Related Questions