pandas 头函数的输出不显示
Output of pandas head function is not displayed
我正在进行 pandas
培训,在第二个实验中我应该打开一个文件并打印前 5 行。问题是,从下面的代码中,我只打印了 "Done",但没有打印 df.head()
的输出。我找不到原因。 ¿有什么建议吗?
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()
您必须将 df.head() 打印到。
print(df.head())
我正在进行 pandas
培训,在第二个实验中我应该打开一个文件并打印前 5 行。问题是,从下面的代码中,我只打印了 "Done",但没有打印 df.head()
的输出。我找不到原因。 ¿有什么建议吗?
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()
您必须将 df.head() 打印到。
print(df.head())