Examples
import numpy as np
import pandas as pd
df = pd.DataFrame({'cost': [200, 150, 100],
'revenue': [100, 200, 250]},
index=['P', 'Q', 'R'])
df
Compare to a MultiIndex by level:
df_multindex = pd.DataFrame({'cost': [200, 150, 100, 150, 250, 120],
'revenue': [100, 200, 250, 180, 155, 125]},
index=[['A1', 'A1', 'A1', 'A2', 'A2', 'A2'],
['P', 'Q', 'R', 'P', 'Q', 'R']])
df_multindex
df.le(df_multindex, level=1)