jbkinney/logomaker

pandas 2.1.0 deprecation warning

Opened this issue · 6 comments

Hi,

with pandas 2.1.0 and logomaker 0.8 I get a deprecation warning:

../condaenv/lib/python3.9/site-packages/logomaker/src//Logo.py:1131: FutureWarning:

Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '<logomaker.src.Glyph.Glyph object at 0x7f775e7b9700>' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.

Not sure how easy to fix or if possible. Just to let you know :)

Thanks & Best,
Michael

Got the same issue. I managed to have plots without warnings just by downgrading pandas to 1.5.3

3f6a commented

I am also seeing this warning recently. Any change logomaker can get an update?

I would say the culprit are these two lines:

glyph_df = pd.DataFrame()

and
glyph_df.loc[p, c] = glyph

The first one creates an empty DataFrame, and it seems empty columns by default have dtype float64. In recent versions of Pandas complain about assigning a value of a different type (Glyph, in the second line) to a column of another type.

Thanks, I will plan to do a release shortly, ~ next couple of weeks.

Thanks, I will plan to do a release shortly, ~ next couple of weeks.

@atareen Hi, any estimation when such a release would happen?

Thanks, I will plan to do a release shortly, ~ next couple of weeks.

Hi @atareen , any news of this update ?
Best,
D.

For any still waiting,
I changed 1073 glyph_df = pd.DataFrame()
to
glyph_df = pd.DataFrame(index=self.ps,columns=self.cs,dtype=object)
which solved the issue. No idea if it is a good solution, but it worked for me