Count in Range
df has a column x of numbers. Return how many rows have x between low and high, both ends included, as an int.
Example 1
df {"x":[1,5,10,15]}
low 5
high 10
returns 2
5 and 10 both count, so the answer is 2.
Constraints
lowmay be bigger thanhigh; then the answer is 0
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More pandas problems
- Drop Duplicate PairsBeginner
- Drop a ColumnBeginner
- Everyone ElseBeginner
- Max per ColumnBeginner
- Missing Price NamesBeginner
- Names in CityBeginner
- Pick Two ColumnsBeginner
- Rename ColumnsBeginner