Python中print(df.head()) 是什么意思

Python070

Python中print(df.head()) 是什么意思,第1张

df是DataFrame的缩写,这里表示读取进来的数据,比如,最简单的一个实例:

import

pandas

as

pd

df

=

pd.read_excel(r'C:\Users\Shan\Desktop\x.xlsx')

print(df.head())

df.head()会将excel表格中的第一行看作列名,并默认输出之后的五行,在head后面的括号里面直接写你想要输出的行数也行,比如2,10,100之类的。

excel表:

输出结果:

用requests库发送一次post请求,只要把字符串写在表单里面就可以了。 import requestsdata = {key:str}#表单用字典格式,字符串作为valuer = requests.post(url,data=data)