In the previous exercise, we saw that when we merge two DataFrames whose rows don’t match perfectly, we lose the unmatched rows.
This type of merge (where we only include matching rows) is called an inner merge. There are other types of merges that we can use when we want to keep information from the unmatched rows.
Suppose that two companies, Company A and Company B have just merged. They each have a list of customers, but they keep slightly different data. Company A has each customer’s name and email. Company B has each customer’s name and phone number. They have some customers in common, but some are different.
If we wanted to combine the data from both companies without losing the customers who are missing from one of the tables, we could use an Outer Join. An Outer Join would include all rows from both tables, even if they don’t match. Any missing values are filled in with
nan (which stands for “Not a Number”).
pd.merge(company_a, company_b, how='outer')
The resulting table would look like this:
There are two hardware stores in town: Store A and Store B. Store A’s inventory is in DataFrame
store_a and Store B’s inventory is in DataFrame
store_b. They have decided to merge into one big Super Store!
Combine the inventories of Store A and Store B using an outer merge. Save the results to the variable
Which values are
What does that mean?