Skip to content

Commit

Permalink
Merge pull request #602 from paulmaxus/changes
Browse files Browse the repository at this point in the history
improve episode 8
  • Loading branch information
alee authored Aug 16, 2022
2 parents 97f762a + 96c7d09 commit 646740a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions _episodes/08-data-frames.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ print(data.iloc[0, 0])

## Use `DataFrame.loc[..., ...]` to select values by their (entry) label.

* Can specify location by row name analogously to 2D version of dictionary keys.
* Can specify location by row and/or column name.

~~~
print(data.loc["Albania", "gdpPercap_1952"])
Expand Down Expand Up @@ -257,7 +257,7 @@ split themselves according to their GDP.
~~~
mask_higher = data > data.mean()
wealth_score = mask_higher.aggregate('sum', axis=1) / len(data.columns)
wealth_score
print(wealth_score)
~~~
{: .language-python}
~~~
Expand Down Expand Up @@ -300,7 +300,7 @@ Finally, for each group in the `wealth_score` table, we sum their (financial) co
across the years surveyed using chained methods:

~~~
data.groupby(wealth_score).sum()
print(data.groupby(wealth_score).sum())
~~~
{: .language-python}
~~~
Expand Down

0 comments on commit 646740a

Please sign in to comment.