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
 


原文地址:https://www.cnblogs.com/SunshineKimi/p/12458378.html