datacarpentry / python-ecology-lesson

Data Analysis and Visualization in Python for Ecologists

Home Page:https://datacarpentry.org/python-ecology-lesson

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Depreciated default setting gives error with pandas>=2.0.1

catchSheep opened this issue · comments

commented

In episodes/02-starting-with-data.md line 519 no longer produces the expected output in pandas>=2, and instead produces a very long error as it tried to take the mean of the non-numeric columns (eg species code, gender etc)

In pandas version 1.5.3 we get a future warning indicating that it will no longer work:
Screenshot from 2023-05-26 08-59-04

This can be fixed by just passing in numeric_only=True to grouped_data.mean(), e.g.:

grouped_data.mean(numeric_only=True)

Screenshot from 2023-05-26 09-02-09

@catchSheep Thanks for your report! Would you like to submit a pr to fix the issue?

commented

No worries, I just made one: #565
I ended up finding three values needing to be changed in this episode, included in that commit

Fixed by #565