Reputation: 91
So I have multiple criteria and I want to use a loop to query them each time so I can filter the data. So essentially I want to:
metric = ["case1", "case2"] #etc
df = df.query('Metric == metric[i]')
#instead of-->
df = df.query('Metric == "case1"')
df = df.query('Metric == "case2"')
metric = ["case1", "case2"] etc
df = df.query('Metric == metric[i]')
#I will loop back around instead of doing them individually
df = df.query('Metric == "case1"')
df = df.query('Metric == "case2"')
Upvotes: 0
Views: 375