I will get condition from json file where the condition is '<=' and need to compare two columns containing dates.
So I tried as below:
left = y['predicate']['left']
right = y['predicate']['right']
grp1 = y['groupby']['groupByFields']
grp2 = y['groupby']['aggregateField']
ope = y['groupby']['aggregateOperation']
res = y['groupby']['result']
logic = y['predicate']['logic']
result[left] = pd.to_datetime(result[left])
result[right] = pd.to_datetime(result[right])
res = result.loc[result[left] + eval(logic) + result[right]]
By using the following code it is working perfectly
res = result.loc[result[left] <= result[right]]
and i tried these also
res = result.loc[eval(str(result[left]) +" " + logic +" " + str(result[right]))]
I am getting error.