I have the following data frame:
import pandas as pd d = {\'gene\' : [\'foo\',\'bar\'],\'score\' : [4., 3.,]} df = pd.DataFrame(d) df.set_index(\'gene\',inpl
Swapping the indices would solve the problem easily:
In [64]: type(df.iloc[0:,]) Out[64]: pandas.core.frame.DataFrame In [65]: df.iloc[[:,0] // Swaped the indices Out[65]: score gene foo 4 bar 3