Append multiple pandas data frames at once Append multiple pandas data frames at once pandas pandas

Append multiple pandas data frames at once


I think you can use concat:

print pd.concat([t1, t2, t3, t4, t5])

Maybe you can ignore_index:

print pd.concat([t1, t2, t3, t4, t5], ignore_index=True)

More info in docs.


Have you simply tried using a list as argument of append? Or am I missing anything?

import numpy as npimport pandas as pddates = np.asarray(pd.date_range('1/1/2000', periods=8))df1 = pd.DataFrame(np.random.randn(8, 4), index=dates, columns=['A', 'B', 'C', 'D'])df2 = df1.copy()df3 = df1.copy()df = df1.append([df2, df3])print df


if the columns each data frame is different you can add for to append :

#list dataframe you want to appendframe = [t1, t2, t3, t4, t5]#new dataframe to store append resultmyDataFrame = pd.DataFrame()for df in frame:    myDataFrame = myDataFrame.append(df)

make sure append success by checking the myDataFrame lenght with :

len(myDataFrame)

if all columns in the data frame is the same or the columns difference each data frame will not be a concern as long as the number of columns of each data frame is the same you can use pd.concat(dataframe) as mention by jezrael.

for more info about append and concat, please click link below :Merge, join, concatenate and compare in Pandas