Project 22: Videos Left-Join Views
Data Analyst
Builds on these lessons
Current Task
Objective
how='left' keeps every row from the left DataFrame, filling in NaN where the right side has no match — unlike the default inner join, which drops unmatched rows.
Task: left-merge a videos DataFrame with a views DataFrame on id and print the result.
index.py
import pandas as pd
videos = pd.DataFrame({'id': [1, 2, 3], 'title': ['Intro', 'Tutorial', 'Demo']})
views = pd.DataFrame({'id': [1, 2], 'views': [1000, 500]})
merged = pd.merge(videos, views, on='id', how='left')
print(merged)
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview