Examples
import numpy as np
import pandas as pd
df = pd.DataFrame({'cost': [350, 250, 200],
'revenue': [200, 350, 400]},
index=['P', 'Q', 'R'])
df
Comparison with a scalar, using either the operator or method:
df == 200
df.lt(200)
Compare to a MultiIndex by level:
df_multindex = pd.DataFrame({'cost': [350, 250, 200, 250, 400, 330],
'revenue': [200, 350, 400, 300, 285, 335]},
index=[['A1', 'A1', 'A1', 'A2', 'A2', 'A2'],
['P', 'Q', 'R', 'P', 'Q', 'R']])
df_multindex
df.lt(df_multindex, level=1)