Skip to content

Commit

Permalink
Merge pull request #234 from QuantEcon/232-tiny-issues-in-pandas-section
Browse files Browse the repository at this point in the history
Update merge.md
  • Loading branch information
doctor-phil authored Jul 19, 2023
2 parents 05cfce8 + 1a39acf commit 98956d6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lectures/pandas/merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ temp = pd.concat([wdi2017, sq_miles], axis=1)
temp["Consumption"] / temp["sq_miles"]
```

Since the WDI data is measured in millions of US Dollars, this gives us the consumption per square mile measured in units of millions of USD per square mile.


## `pd.merge`

`pd.merge` operates on two DataFrames at a time and is primarily used
Expand Down Expand Up @@ -258,6 +261,8 @@ wdi_pop["GDP"] / wdi_pop["Population"]
wdi_pop["Consumption"] / wdi_pop["Population"]
```

These numbers tell us the GDP and consumption per capita, measured in units of millions of USD per person.

````{admonition} Exercise
:name: pd-mrg-dir1
See exercise 1 in the {ref}`exercise list <pd-mrg-ex>`.
Expand Down Expand Up @@ -346,10 +351,10 @@ the image below.

In words, we have:

- `left`: Default and what we described above. It uses
- `left`: What we described above. It uses
the keys from the `left` DataFrame.
- `right`: Output will contain all keys from `right`.
- `inner`: The output will only contain keys that appear in *both*
- `inner`: The default `how`; the output will only contain keys that appear in *both*
`left` and `right`.
- `outer`: The output will contain any key found in either `left`
or `right`.
Expand Down

1 comment on commit 98956d6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.