Stage 1 · Lesson 6 of 7
Joining tables
Real data arrives in pieces: orders in one file, customers in another, products in a third. A combines two tables on a key column, like a SQL join. A left join keeps every row of the left table and adds matching columns from the right, filling gaps with missing values when there is no match.
In it is merge; in dplyr it is left_join and its siblings. Always check the row count before and after a join, and tell the tool what relationship you expect, such as many orders to one customer, so it errors when that is false.
Common trapjoining on a key that is not unique in the lookup table: every duplicate multiplies rows and inflates every total that follows, with no error message.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking Python Fundamentals
Design Gurus · Beginner · $50
Solid Python basics first: data types, collections, functions and files, the ground pandas stands on
- CourseFreeKaggle Learn
Kaggle · Beginner
Free: the Python and Pandas courses, short lessons with exercises that run in the browser