Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test: test_merge_and_average fails with a TypeError with pandas 2.0.3 #84

Open
olp-cs opened this issue Jul 16, 2024 · 0 comments · May be fixed by #85
Open

Failing test: test_merge_and_average fails with a TypeError with pandas 2.0.3 #84

olp-cs opened this issue Jul 16, 2024 · 0 comments · May be fixed by #85

Comments

@olp-cs
Copy link

olp-cs commented Jul 16, 2024

The test is failing on platforms:

  • Linux-6.1.85+-x86_64-with-glibc2.35
    • Python 3.10.12
    • pandas 2.0.3
    • numpy 1.25.2
  • Windows-11-10.0.22631-SP0
    • Python 3.12
    • pandas 2.2.2
    • numpy 2.0.0

Update: The test passes with Python 3.8 and pandas 1.3.0; it seems to be a backward compatibility issue with pandas.

Failed test:

test_GEOparse.py:626 (TestGSE.test_merge_and_average)

TypeError: agg function failed [how->mean,dtype->object]

TypeError: Could not convert string 'DNA segment, Chr 8, ERATO Doi 594, expressed' to numeric

The test fails on this line:

..\src\GEOparse\GEOTypes.py:445: in annotate_and_average

tmp_data = tmp_data.groupby(group_by_column).mean()[[expression_column]]

where

  • tmp_data is a pandas dataframe that contains both numeric and string columns (attached: tmp_data.csv);
  • expression_column = 'VALUE'
  • group_by_column = 'GB_ACC'

Jupyter notebook reproducing the issue:
https://gist.github.com/olp-cs/9902b5cdc554afbf3faa7127ee602f20

Would it make sense to filter the columns first, to keep the numerical ones only?

@olp-cs olp-cs changed the title Failing test: test_merge_and_average fails with a TypeError Failing test: test_merge_and_average fails with a TypeError with pandas 2.0.3 Jul 22, 2024
@olp-cs olp-cs linked a pull request Jul 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant