Steps to append multiple Dataframe in Python

Append is stacking datafiles one after another. It is a process of vertically stacking Dataframes to create a single large Dataframe. Many a times data is present not as a single file but can be available as multiple files. For example monthly transactions stored in different files. To start analyzing data it becomes important to create a single file. Appending helps to achieve that. This article explains easy steps to append multiple Dataframe in Python.

Amy has 4 months of transaction data available with her. She wants to start analysis on the same. Before that she is looking forward to create single file from the multiple Dataframe available.

Steps to append multiple Dataframe in Python
Steps to append multiple Dataframe in Python
Steps to append multiple Dataframe in Python
Steps to append multiple Dataframe in Python

Below are the steps to create single Dataframe:

  • Step 1: Import all necessary modules in Python.
import pandas as pd
  • Step 2: Use Pandas append function to append multiple Dataframes. All the subsequent files can be listed within the parenthesis of the function. Please see the code below.
Trx_Data_4Months=Trx_Data_Apr20.append([Trx_Data_May20,Trx_Data_Jun20,Trx_Data_Jul20])
  • Step 3: Check output data quality. As there are 100 rows in each transaction file, the final Dataframe will have 400 rows. Hence, checking shape of file is important.
Trx_Data_4Months.head(10)
Trx_Data_4Months.tail(10)
#Print Shape of the file, i.e. number of rows and number of columns
 Trx_Data_4Months.shape
Steps to append multiple Dataframe in Python

Thus, Amy is able to create single Dataframe as per her requirement in Python.

To get top certifications in Python and build your resume visit here. Also, you can read books listed here to build strong knowledge around Python.

Visit us below for video tutorial:

 Looking to practice more with this example? Drop us a note, we will email you the Code file: 

    📬 Stay Ahead in Data Science & AI – Subscribe to Newsletter!

    • 🎯 Interview Series: Curated questions and answers for freshers and experienced candidates.
    • 📊 Data Science for All: Simplified articles on key concepts, accessible to all levels.
    • 🤖 Generative AI for All: Easy explanations on Generative AI trends transforming industries.

    💡 Why Subscribe? Gain expert insights, stay ahead of trends, and prepare with confidence for your next interview.

    👉 Subscribe here:

    Related Posts