pd.contact,dataframe 拼接


  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

 

 

 



免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM