I am trying to work with a pandas multiindex dataframe that looks like this:
end ref|alt
chrom start
chr1 3000714 3000715 T|G
3001065 3001066 G|T
3001110 3001111 G|C
3001131 3001132 G|A
I want to be able to do this:
df.loc[('chr1', slice(3000714, 3001110))]
That fails with the following error:
cannot do slice indexing on with these indexers [1204741] of
df.index.levels[1].dtype returns dtype('int64'), so it should work with integer slices right?
Also, any comments on how to do this efficiently would be valuable, as the dataframe has 12 million rows and I need to query it with this kind of slice query ~70 million times.