higlass / clodius

Clodius is a tool for breaking up large data sets into smaller tiles that can subsequently be displayed using an appropriate viewer.
MIT License
39 stars 21 forks source link

Pandas FutureWarning: Series.__getitem__ deprecation warning #152

Open manzt opened 6 months ago

manzt commented 6 months ago

In higlass-python, I'm getting an error with bigwig tracks:

import higlass as hg

ts = hg.bigwig("/Users/manzt/Downloads/data.bw")
hg.view(ts.track().opts(barFillColor="red"))
image
clodius/tiles/utils.py:275: FutureWarning: Series.__getitem__ treating keys as positions is deprecated.
In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior).
To access a value by position, use `ser.iloc[pos]`
  yield cid, start, chromsizes[cid]

warning is referencing this line:

https://github.com/higlass/clodius/blob/de67e9df2cd296d3681dcf438c0895638de672e4/clodius/tiles/utils.py#L275

manzt commented 6 months ago

Is the fix just to chromsizes.iloc[cid]? I'm not familiar enough with the code.

nvictus commented 6 months ago

That should be it. I think chromsizes is always a Series[str, int], being indexed by position. The docstring seems to be wrong.