I would like to get the average of ColA
when ColB
is between 7 and 8. So in this case it would be 5.5. I have tried:
Avg = ColA[7 <= ColB <= 8].mean()
The problem is that I get the following error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
If I use just one condition, then it executes without errors.
Avg =ColA[ColB >= 7].mean()
print(Avg)
How can I use get the average of one column when the values of a different column are between two set va