I am trying to find some way of appending multiple pandas data frames at once rather than appending them one by one using
df.append(df)
Le
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 np
import pandas as pd
dates = 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
#Row wise appending
combined_data = pd.concat([t1, t2, t3, t4, t5], axis=0)
This will stack one dataframe over another
#column wise appending
combined_data = pd.concat([t1, t2, t3, t4, t5], axis=1)
This will append the 2nd dataframe on the right side of the 1st dataframe