Home > Article > Backend Development > How to Append Multiple Pandas DataFrames Simultaneously?
Appending Multiple Pandas Data Frames Simultaneously
You want to avoid appending pandas data frames one by one using the df.append(df) method. Consider data frames t1, t2, t3, t4, and t5. To append them collectively, you seek an equivalent to df = rbind(t1,t2,t3,t4,t5) in R.
Solution
To append multiple data frames at once, you can utilize the concat function:
<code class="python">import pandas as pd df = pd.concat([t1, t2, t3, t4, t5])</code>
Ignoring Index
Additionally, you may wish to ignore the index during concatenation:
<code class="python">df = pd.concat([t1, t2, t3, t4, t5], ignore_index=True)</code>
Refer to the documentation for more information on the concat function.
The above is the detailed content of How to Append Multiple Pandas DataFrames Simultaneously?. For more information, please follow other related articles on the PHP Chinese website!