datacarpentry / python-ecology-lesson

Data Analysis and Visualization in Python for Ecologists
https://datacarpentry.org/python-ecology-lesson
Other
160 stars 310 forks source link

Depreciated default setting gives error with pandas>=2.0.1 #564

Closed catchSheep closed 1 year ago

catchSheep commented 1 year ago

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

btovar commented 1 year ago

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

catchSheep commented 1 year ago

No worries, I just made one: https://github.com/datacarpentry/python-ecology-lesson/pull/565 I ended up finding three values needing to be changed in this episode, included in that commit

btovar commented 1 year ago

Fixed by #565