To append multiple Python Pandas data frames at once, we can use the append
method.
For instance, we write
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])
to create 2 data frames df1
and df2
.
And then we make copied of them with copy
.
Finally, we call append
with a list with df1
and df2
in it.