I am referring to 307.5 “The mode - Special cases” and 285.10 “Frequency distributions - Readability for grouped frequency tables”.

The code provided uses explicit cycles over values and intervals. Although the same result can be achieved by using pandas.cut() and pandas.Series.value_counts().

Example is from 307

```
intervals = pd.interval_range(start = 0, end = 800000, freq = 100000)
gr_freq_table = pd.Series([0,0,0,0,0,0,0,0], index = intervals)
for value in houses['SalePrice']:
for interval in intervals:
if value in interval:
gr_freq_table.loc[interval] += 1
break
print(gr_freq_table)
```

is the same as

```
intervals = pd.interval_range(start = 0, end = 800000, freq = 100000)
print(pd.cut(houses['SalePrice'], bins=intervals).value_counts().sort_index())
```