I have a DataFrame df1:
df1 = pd.DataFrame([[31,12,32,65],[42,19,22,78],[76,13,45,68],[43,37,43,71],[43,18,34,73]],columns=['A', 'B', 'C', 'D'])
and another DataFrame df2:
df2 = pd.DataFrame([["B",">20"],["C",">40"],["D","<70"],["A","<40"]],columns = ["Feature","Condition"])
Want to perform operation on df1 using respective conditions present in df2. The result should be a DataFrame which meets either of the condition present in df2 as shown below Output.
Output = pd.DataFrame([[31,12,32,65],[76,13,45,68],[43,37,43,71]],columns=['A', 'B', 'C', 'D'])
How to do it? Please help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.