groupby.mean() has numeric_only= argument whose default value was True in the past but since pandas 2.0, its default value is False.
An implication is that string columns are not dropped when a statistical method such as mean or std is called on the groupby object (as was done in the past). To solve the issue, pass numeric_only=True.
About
Accompany and complete:
Conclude and finalize fixes:
Details