I have multiple dataframes like below.
DF1:
DF2
DF3
I want to store them to a file like below.So the data should be in sequential order from each dataframe. Can any one help me to find a way to store in the below format in a file.
Use df.append
:
df = DF1.append(DF2).append(DF3)
Then write it to a file using df.to_csv()
file:
df.to_csv('test.csv')
OR to an excel file using df.to_excel()
:
df.to_excel('test.xls')
OR (as per @anky 's comment): use pd.concat
df_list = [DF1,DF2,DF3] ## create a list with your dataframes
df = pd.concat(df_list)
df.to_csv('test.csv')