import pandas as pd
data={
"姓名":["楚枫","楚月","楚狐宇"],
"年龄":["16","17","18"],
"性别":["男","女","男"]
}
df=pd.DataFrame(data)
#显示df
print(df)
#修改索引
df2=pd.DataFrame(data,index=[2,3,4])
#显示df
print(df2)
运行结果:
标签:下标,df,DataFrame,pd,print,data,pandas From: https://blog.51cto.com/u_15937426/7710757