Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor changes to 08-data-frames #602

Merged
merged 2 commits into from
Aug 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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