给已经建好的DataFrame中添加一行
# 构建一个dataframe
df = pd.DataFrame(columns=['name','number'], data=[['cat',3], ['dog',2],['pig',1]])
df
name number
0 cat 3
1 dog 2
2 pig 1
# 插入一行,随便设置索引,比如按照字符串作为索引
df.loc['new'] = ['duck', 10]
df
name number
0 cat 3
1 dog 2
2 pig 1
new duck 10
Address:北京
Date:20200910
喜欢可以关注【小猪课堂】公众号了解更多内容