Mat*_*ene 0 python head pandas
我正在pandas接受培训,在第二个实验室中,我应该打开一个文件并打印前 5 行。问题是,从下面的代码中,我只打印了“完成”,但没有打印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()
Run Code Online (Sandbox Code Playgroud)
你也必须打印 df.head() 。
print(df.head())
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2253 次 |
| 最近记录: |