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

[Chapter 27] Couple of possible improvements #25

Open
AlessandroMiola opened this issue Oct 29, 2022 · 0 comments
Open

[Chapter 27] Couple of possible improvements #25

AlessandroMiola opened this issue Oct 29, 2022 · 0 comments

Comments

@AlessandroMiola
Copy link

Hi Matt, thanks for your book, really enjoying it. I'd suggest a couple of changes in chapter 27:

  1. Within the description of the parameters of method pandas.DataFrame.groupby() at page 322, I'd change the specification of dropna. Indeed, this works differently than the same parameter in pandas.DataFrame.pivot_table() or in function pandas.crosstab(), where it applies to values (and therefore << [...] dropna=False will keep columns that have no values >>). Instead, in pandas.DataFrame.groupby() dropna applies to group keys (the description above - which is specified in the book - is no longer valid). For this reason, the DataFrame at page 305 should have 8 columns, rather than 4.
  2. At pages 313-314 of the book, per column aggregations are not applied on numeric columns only, which we instead may possibly get by typing jb2.groupby('country_live')[[col for col in jb2.select_dtypes('number').columns]].agg(['min', 'max']).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant