choropleth.py 文件源码

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

项目:clchoropleth 作者: slarrain 项目源码 文件源码
def discretize(data, bins=5, quantile=False):
    '''
    Creates 'bins' number of bins and discretizes the data.
    Uses cut function by default. qcut function otherwise.
    '''
    if quantile:
        new_data = pd.qcut(data, bins, labels=list(range(bins)))
    else:
        new_data = pd.cut(data, bins, labels=list(range(bins)))
    return new_data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号