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
  • 394
  • 3
  • 19

1 Answers1

0

You can use the following solution:

len(df.query("10 < Points < 100"))
Grant Miller
  • 27,532
  • 16
  • 147
  • 165
Victor Yan
  • 3,339
  • 2
  • 28
  • 28