0

I have a Python Dataframe with a column called points.

Points
20
5000
1
30
20

I want to count the number of values within a certain range, lets say between 10 and 100, which should return 3 in this case. How do I do that in Python? I know I can use (df["Points"] == 20).sum() to return the count of values = 20 which will give 2 in this case, but I don't know how to do it for a range of values.

Pleastry
  • 344
  • 1
  • 14

1 Answers1

0

You can use the following solution:

len(df.query("10 < Points < 100"))
Grant Miller
  • 24,187
  • 16
  • 134
  • 150
Victor Yan
  • 3,022
  • 2
  • 22
  • 27