Skip to content

[Chapter 27] Couple of possible improvements #25

@AlessandroMiola

Description

@AlessandroMiola

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']).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions