Skip to content

Commit

Permalink
Merge pull request #121 from martinfleis/recursion
Browse files Browse the repository at this point in the history
BUG: fix headtail recursion
  • Loading branch information
ljwolf committed Dec 11, 2021
2 parents 92054a9 + 4290099 commit b49c8c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mapclassify/classifiers.py
Expand Up @@ -93,9 +93,8 @@ def _format_intervals(mc, fmt="{:.0f}"):
For some classifiers, it is possible that the upper bound of the first interval is less than the minimum value of the attribute that is being classified. In these cases `lower_open=True` and the lower bound of the interval is set to `np.NINF`.
"""


lowest = mc.y.min()
if hasattr(mc, 'lowest'):
if hasattr(mc, "lowest"):
if mc.lowest is not None:
lowest = mc.lowest
lower_open = False
Expand Down Expand Up @@ -182,6 +181,8 @@ def head_tail_breaks(values, cuts):
"""
values = np.array(values)
mean = np.mean(values)
if len(cuts) > 0 and cuts[-1] == mean: # fix floating point issue #117
return cuts
cuts.append(mean)
if len(set(values)) > 1:
return head_tail_breaks(values[values > mean], cuts)
Expand Down

0 comments on commit b49c8c9

Please sign in to comment.