liveBook · Manning

Left outer join

As explained in Pandas Workout: 200 exercises to make you a stronger data analyst

A left join retains rows driven by the left input and attaches matching rows from the right input when available.

A left outer join combines normalized data while preserving the rows driven by the left DataFrame. Matching rows from the right DataFrame are attached when available, making separate datasets analyzable together. section 6.8

Combine products with sales

Set product_id as the index in products_df and sales_df, then run products_df.join(sales_df). The product rows drive the result, while matching sales information is attached. Continue by grouping the joined result by name, date, or both, then summing quantity or retail_price. section 6.8

products_df.join(sales_df)

Inspect the concise pandas operation that joins products_df and sales_df after product_id becomes the index. section 6.8

How Pandas Workout: 200 exercises to make you a stronger data analyst covers it

How deep it goes
Explains the left-side row-selection rule and demonstrates index preparation, joining, grouping, and aggregation.
Examples
Uses products_df and sales_df, joined on product_id, then groups results by product name, date, or both.
What it assumes
Assumes familiarity with DataFrames and introduces joining separated normalized data through indexes.
What you can do after
Apply it via pandas DataFrame.join to combine normalized datasets and aggregate values from the resulting rows.
How it connects
Connects left joins with data normalization, DataFrames, indexes, grouping, aggregation, and outer joins.

Also explained in

Compare how 6 books explain left outer join →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pandas Workout: 200 exercises to make you a stronger data analyst. The section links point to the parts of the book it draws on.