Df.loc[lambda Df: Df['score'] > 15 and Df['score'] < 20]
I am getting the mentioned error while using the above-mentioned code. Thanks in advance Error : ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
The main issue is the lack of parenthesis around the expressions.
There are two other issues in your code:
Here's a piece of code that would work:
df.loc[(df['score'] > 15) & (df['score'] < 20)]