0

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?

Dukakus17
  • 1,221
  • 4
  • 15
  • 32
  • Nothing, look at your variable explorer pan, you will find data (type: dataframe) click that and you can see your data. To print data head in console you have to type `print(data.head())` – Arun Kumar Khattri Aug 08 '17 at 06:34

2 Answers2

2

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

voidpro
  • 1,652
  • 13
  • 27
1

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

Arun Kumar Khattri
  • 1,519
  • 15
  • 25