@classmethod
    def from_list(cls, buckets, bucket_offsets=None):
        if not bucket_offsets:
            bucket_offsets = cls.BUCKET_OFFSETS
        h = cls()
        if bucket_offsets == cls.BUCKET_OFFSETS:
            for i, v in enumerate(buckets):
                h.buckets[i] = v
            h.total = sum(buckets)
        else:
            for i, v in enumerate(buckets):
                # hack because binary_search does an exclusive max
                h.add(bucket_offsets[i]-1, v)
        return h
This method will be lossy if the bucket_offsets are different
dataset/ETHPy150Open wadey/python-ostrich/ostrich/histogram.py/Histogram.from_list