utils.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:open-syllabus-project 作者: davidmcclure 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号