I have two dataframes that I'd like to merge:
df1=pd.DataFrame([['a','b','c'],['e','f','g'],['h','i','j']], columns=['X','Y','Z'], index=[10,15,25]) df2=pd.DataFrame([['A','B','C'],['H','I','J']], columns=['X','Y','Z'], index=[12,22]) #df1 X Y Z 10 a b c 15 e f g 25 h i j #df2 X Y Z 12 A B C 22 H I J I'd like to merge them sequentially, such that the rows in df2 are added to df1, on the same columns since columns would contain data from both.
# intended output X Y Z 10 a b c 12 A B C #from df2 15 e f g 22 H I J #from df2 25 h i j
pd.concat([df1,df2], axis=0, sort=True)