Issue
I currently have the following code:
df[(df.Edition == 2004) & (df.Discipline == "Athletics") | (df.Discipline == "Aquatics")]
However, this (rightfully) returns every entry where Edition is 2004, and discipline is EITHER Athletics or Aquatics (thus giving me entries where Edition is not 2004). However, I want to pull all entries where Discipline is Athletics OR Aquatics but the Edition is locked to 2004. How can I query that?
Solution
Get your parenthesis right:
>>> df[(df.Edition == 2004) &
((df.Discipline == "Athletics") |
(df.Discipline == "Aquatics"))]
Answered By - rafaelc
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.