raphaelvallat / pingouin

Statistical package in Python based on Pandas
https://pingouin-stats.org/
GNU General Public License v3.0
1.61k stars 138 forks source link

Pairwise tests with mixed design fail with new pandas 2.0 #362

Closed jajcayn closed 1 year ago

jajcayn commented 1 year ago

Hey @raphaelvallat, I noticed that the example on pairwise tests with mixed design (number 4 here> https://pingouin-stats.org/build/html/generated/pingouin.pairwise_tests.html#pingouin.pairwise_tests) fails after update to pandas 2.0 with

TypeError: Could not convert AugustJanuaryJune to numeric
jajcayn commented 1 year ago

I was able to track the error to line 478 in pairwise.py - continuing with your example on pairwise tests:

df.groupby(["Subject", "Group"], as_index=False, observed=True, sort=True).mean()

gives

TypeError: Could not convert AugustJanuaryJune to numeric
jajcayn commented 1 year ago

mean(numeric_only=True) fixes it, I'll open a PR