🐍 Data Analyst Interview Series: Part 31
Guys, let's continue our Python Interview Series.
In the previous part, we covered Pandas GroupBy and Aggregation. Today, let's focus on combining datasets and reshaping data using Pandas.
Part 31, Pandas Merge, Join, Concat & Pivot Tables
1️⃣ What is the difference between merge() and concat() in Pandas?
Both functions combine DataFrames, but they work differently.
merge() combines DataFrames based on common columns or indexes, similar to SQL JOIN operations.
import pandas as pd
result = pd.merge(df1, df2, on="CustomerID")
concat() combines DataFrames along rows or columns.
result = pd.concat([df1, df2], axis=0)
Merge → Combine based on matching keys.
Concat → Stack DataFrames along rows or columns.
2️⃣ What are the different types of joins in Pandas?
Pandas supports different types of joins through the merge() function.
T