python-novice-gapminder icon indicating copy to clipboard operation
python-novice-gapminder copied to clipboard

Solution to "Comparing Data" (Ep. 14) throws deprecation warning

Open alex-ball opened this issue 4 years ago • 0 comments

As of Pandas 1.3.0 (July 2, 2021), the solution to "Comparing Data" in episode 14 throws the same warning several times.

https://github.com/swcarpentry/python-novice-gapminder/blob/f675de6edcefc46f3a655d3c92c9fb9e28222983/_episodes/14-looping-data-sets.md#L169-L176

FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError. Select only valid columns before calling the reduction.

The problem is in line 176, and the quickest fix is simply to flip the toggle the other way:

    dataframe.mean(numeric_only=True).plot(ax=ax, label=region)

But this is a bit of extra cognitive load. Should we just tell learners about this in advance, or is there an alternative solution that avoids the issue? Or should the task itself be adjusted?

alex-ball avatar Dec 23 '21 16:12 alex-ball