Data Science
Concatenating and Appending Data
SQL Mastery Team
May 13, 2026
5 min read
It's **Day 112**. In SQL, you had `UNION`. In Pandas, we have `pd.concat()`.
Vertical Concatenation (Stacking)
Use this when you have the same columns but different rows (e.g., "Sales January" and "Sales February").
# Stack them on top of each other
full_year = pd.concat([jan_df, feb_df], axis=0)
Horizontal Concatenation (Side-by-Side)
Use this when you have the same rows but different columns for both.
# Glue them side-by-side
combined = pd.concat([data_df, metadata_df], axis=1)
Intersection vs Union
When you concat, what happens if one table has a column the other doesn't?
Your Task for Today
Create two small DataFrames with slightly different columns and use `pd.concat` with both `inner` and `outer` joins to see the difference.
*Day 113: Reshaping Data with Pivot and Melt.*