As you know, basic indexing in Pandas is really easy.
import pandas as pd
df = pd.DataFrame({'a':[1,2,3,4]})
Let's say I want every row where 'a' is greater than 2.
df[df['a'] > 2]
Ok, but now how do I use multiple conditionals? Let's try and find every row where 'a' is in range(2,4).
df[df['a'] in range(2,4)]
df[1 < df['a'] < 4]
df[df['a'] >1 and df['a'] <4]
All of these lines return the error message:
"The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()."
But as far as I can tell, these methods don't do what I'm attempting.
EDIT: Found the answer right after posting.
df[df.a > 1][df.a < 4]