stack pandas dataframes vertically code example
Example 1: stack data horizontally pandas
import pandas as pd
df1 = pd.DataFrame({
'A': [1,2,3,4,5],
'B': [1,2,3,4,5]
})
df2 = pd.DataFrame({
'C': [1,2,3,4,5],
'D': [1,2,3,4,5]
})
df_concat = pd.concat([df1, df2], axis=1)
print(df_concat)
Example 2: concatenate data vertically python
dfmfs = pd.concat([dfmf,dfms], axis=0)