0
0
Data Analysis Pythondata~5 mins

Left and right joins in Data Analysis Python - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a left join in data analysis?
A left join keeps all rows from the left table and adds matching rows from the right table. If no match is found, it fills with missing values (like NaN).
Click to reveal answer
beginner
What does a right join do?
A right join keeps all rows from the right table and adds matching rows from the left table. If no match is found, it fills with missing values.
Click to reveal answer
beginner
In pandas, which function and parameter do you use to perform a left join?
Use pd.merge(left_df, right_df, how='left', on='key_column') to do a left join on the key column.
Click to reveal answer
beginner
What happens to rows in the right table that do not match any row in the left table during a left join?
They are dropped because the left join keeps all rows from the left table only.
Click to reveal answer
intermediate
How is a right join different from an inner join?
A right join keeps all rows from the right table, even if no match exists in the left table. An inner join keeps only rows with matches in both tables.
Click to reveal answer
Which join keeps all rows from the left table and matches from the right?
ALeft join
BRight join
CInner join
DOuter join
In pandas, how do you specify a right join?
Ahow='left'
Bhow='right'
Chow='inner'
Dhow='outer'
What happens to unmatched rows in the right table during a left join?
AThey are dropped
BThey are kept with missing values
CThey become duplicates
DThey are merged with default values
Which join keeps all rows from both tables, filling missing matches with NaN?
ALeft join
BRight join
CInner join
DOuter join
If you want only rows with matching keys in both tables, which join do you use?
ALeft join
BRight join
CInner join
DOuter join
Explain in your own words what a left join does and give a real-life example.
Think about keeping all your friends and adding info about their pets if available.
You got /4 concepts.
    Describe the difference between a left join and a right join with a simple analogy.
    Imagine two lists: one is your shopping list (left), the other is what’s in the fridge (right).
    You got /4 concepts.