malariagen / malariagen-data-python

Analyse MalariaGEN data from Python
https://malariagen.github.io/malariagen-data-python/latest/
MIT License
13 stars 23 forks source link

Pandas FutureWarning: Setting an item of incompatible dtype is deprecated #535

Open jonbrenas opened 1 month ago

jonbrenas commented 1 month ago

Resolves #532.

It is, however, by removing a piece of code that replaced nan by '' so I don't know if we want to find another solution.

alimanfoo commented 1 month ago

It is, however, by removing a piece of code that replaced nan by '' so I don't know if we want to find another solution.

Thanks @jonbrenas, yes I think we will need to find another solution. Otherwise I think the tooltips in the genes plot will contain lots of "nan" labels which is a bit ugly.

leehart commented 4 weeks ago

Hi @jonbrenas . I wonder if we can use the Float64 type, which is supports nulls, instead of float64, and still convert the nulls to empty strings for presentation?

alimanfoo commented 3 weeks ago

Hi @jonbrenas . I wonder if we can use the Float64 type, which is supports nulls, instead of float64, and still convert the nulls to empty strings for presentation?

I think the warning is due to attempting to replace nulls with the empty string (""). So probably using Float64 instead of float64 won't help I'm guessing. Perhaps the column should be cast to a string dtype, then fill nulls with empty string?

jonbrenas commented 3 weeks ago

Looking a little bit more closely at the warming, I realised that the problem comes from phase and score, two columns that are actually not used by plot_genes (and luckily are named the same in both ag3 and af1). I just drop them in the function and that makes the warning disappear (at least in my tests).

alimanfoo commented 3 weeks ago

Looking a little bit more closely at the warming, I realised that the problem comes from phase and score, two columns that are actually not used by plot_genes (and luckily are named the same in both ag3 and af1). I just drop them in the function and that makes the warning disappear (at least in my tests).

Ah cool, that sounds good.

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.87%. Comparing base (dc89c9c) to head (e53682e). Report is 24 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #535 +/- ## ========================================== - Coverage 98.61% 95.87% -2.75% ========================================== Files 38 39 +1 Lines 3690 3826 +136 ========================================== + Hits 3639 3668 +29 - Misses 51 158 +107 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

leehart commented 3 weeks ago

Re: #554