0
点赞
收藏
分享

微信扫一扫

pd.contact,dataframe 拼接

祈澈菇凉 2022-09-20 阅读 193

a=np.random.choice(10,(3,4))
b=np.random.choice((100,500),(3,4))
df1=pd.DataFrame(a,columns=["x1","x2","x3","x4"],index=["a","b","c"])
df2=pd.DataFrame(b,columns=["x1","x2","x3","x4"],index=["b","c","d"])
print(pd.concat([df1,df2],ignore_index=False))

  

# ignore_index=True todo index default: 0,1,2,.....

 

 

# ignore_index False a,b,c,b,c,d

 

 



举报

相关推荐

0 条评论