ops = {'eq': operator.eq, 'neq': operator.ne, 'gt': operator.gt, 'ge':
    operator.ge, 'lt': operator.lt, 'le': operator.le}
return df[ops[op](df[col], val)]
pandas.DataFrame.filt_spec = filt_spec
Efficient way to apply multiple filters to pandas DataFrame or Series