from collections.abc import Iterable
改为from collections import Iterable
from math import isfinite
改为 import math
values = [i for i in values if isfinite(i)]
改为values = [i for i in values if np.isfinite(i)]
import jenkspy
import random
''' jenks_breaks(
[1.3, 7.1, 7.3, 2.3, 3.9, 4.1, 7.8, 1.2, 4.3, 7.3, 5.0, 4.3],
nb_class = 3) # Should output (1.2, 2.3, 5.0, 7.8)
'''
list_of_values = [1.3, 7.1, 7.3, 2.3, 3.9, 4.1, 7.8, 1.2, 4.3, 7.3, 5.0, 4.3]
breaks = jenkspy.jenks_breaks(list_of_values, nb_class=3)
print(breaks)
运行结果正确:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)