I have a pandas df and would like to accomplish something along these lines (in SQL terms):
SELECT * FROM df WHERE column1 = 'a' OR column2 = 'b' OR column3 = 'c' etc.
Now this works, for one column/value pair:
foo = df.loc[df['column']==value]
However, I'm not sure how to expand that to multiple column/value pairs.
- To be clear, each column matches a different value.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…