def partitions(min_val, max_val, n):
"""
Get start/stop boundaries for N partitions.
Args:
min_val (int): The starting value.
max_val (int): The last value.
n (int): The number of partitions.
"""
pts = np.array_split(np.arange(min_val, max_val+1), n)
bounds = []
for pt in pts:
bounds.append((int(pt[0]), int(pt[-1])))
return bounds
评论列表
文章目录