Matias Salimbene
Matias Salimbene

Reputation: 605

Output of pandas head function is not displayed

I'm doing a pandas training and on the second lab i'm supposed to open a file and print the first 5 rows. The problem is that from the code below I only get the "Done" printed, but it isn't printing the output from df.head(). I cannot find a reason why. ¿Any tips?

import pandas as pd

filename="https://archive.ics.uci.edu/ml/machine-learning- 
databases/autos/imports-85.data"

hs = ["symboling","normalized-losses","make","fuel-type","aspiration", 
   "num-of-doors","body-style", "drive-wheels","engine-location","wheel-base", "length","width","height","curb-weight","engine-type", "num-of-cylinders", "engine-size","fuel-system","bore","stroke","compression-ratio","horsepower",
     "peak-rpm","city-mpg","highway-mpg","price"]

df = pd.read_csv(filename, names=hs)
print("Done")
df.head()

Upvotes: 2

Views: 6068

Answers (1)

RMelo
RMelo

Reputation: 430

You have to print the df.head() too.

print(df.head())

Upvotes: 10

Related Questions