I have below data frame and the columns are the primary key column of a table
import pandas as pd
data = {'Product': ['Tablet','Printer','Laptop','Monitor'],
'Price': [250,100,1200,300] }
df = pd.DataFrame(data)
I want to generate below where condition as a string to return:
Please note I'm not looking for fitering the pandas data frame. I'm looking for generating the string according to the pandas data frame and it's not the same as the one linked by the administrator...
where (Product='Tablet' AND Price=250 )
OR (Product = 'Printer' AND PRICE = 100)
OR (Product = 'Laptop' AND PRICE = 1200)
OR (Product = 'Monitor' AND PRICE = 300)
Can you please advise if there's an elegant way to achieve it?
Thanks