Is there a short-cut to drop rows with equal multi indexes? In other words, is there any way to compare indexes without convert them to columns? Here goes how I'm doing so far, but I fill there is something better. Thanks in advance.
>>> df
0 1 2 3
bar one -1.557968 -1.541893 0.804695 0.838684
bar -0.148502 0.778159 1.349751 -3.127047
baz one -0.959053 -1.162494 -0.235791 1.239830
two -1.515304 -0.177502 -1.476930 -1.340431
foo foo -0.797550 0.788936 0.126020 0.229524
two 0.902523 0.717078 -0.038424 0.339487
>>> df = df.reset_index()
>>> cond = (df2['level_0'] == df2['level_1'])
>>> df = df.drop(df[cond].index.values)
>>> df
level_0 level_1 0 1 2 3
0 bar one -1.557968 -1.541893 0.804695 0.838684
2 baz one -0.959053 -1.162494 -0.235791 1.239830
3 baz two -1.515304 -0.177502 -1.476930 -1.340431
5 foo two 0.902523 0.717078 -0.038424 0.339487
You can use
df.index.get_level_values()
to get multi-level index values directly.