In [ ]:
def my_mask(df,column,condition,value):
new_data = []
if condition == "==":
new_data = df[df[column] == value]
elif condition == "<=":
new_data = df[df[column] <= value]
elif condition == "!=":
new_data = df[df[column] != value]
elif condition == ">=":
new_data = df[df[column] >= value]
elif condition == ">":
new_data = df[df[column] > value]
elif condition == "<":
new_data = df[df[column] < value]
else:
print "arguments needed-column,condition,value-:"
return new_data
In [ ]: