【发布时间】:2022-01-23 05:54:57
【问题描述】:
import pandas as pd
df = pd.read_html("https://github.com/KeithGalli/pandas/blob/master/pokemon_data.csv")
print (df)
它工作正常,然后当我尝试对文件进行操作时,它只会给我以下错误:
AttributeError Traceback (most recent call last)
<ipython-input-24-eb4b6e6a1e41> in <module>()
----> 1 print (df.head)
AttributeError: 'list' object has no attribute 'head'
【问题讨论】:
-
pd.read_html返回数据帧列表,而不是数据帧。使用df[0].head()查看第一个表。
标签: pandas google-colaboratory