histogram_filling.py 文件源码

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

项目:Eskapade 作者: KaveIO 项目源码 文件源码
def value_to_bin_index(val, **kwargs):
    """Convert value to bin index

    Convert a numeric or timestamp column to an integer bin index.

    :param bin_width: bin_width value needed to convert column to an integer bin index
    :param bin_offset: bin_offset value needed to convert column to an integer bin index
    """

    try:
        # NOTE this notation also works for timestamps
        bin_width = kwargs.get('bin_width', 1)
        bin_offset = kwargs.get('bin_offset', 0)
        bin_index = int(np.floor((val - bin_offset) / bin_width))
        return bin_index
    except BaseException:
        pass
    return val
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号