Reference

class distogram.Distogram(bin_count: int = 100, weighted_diff: bool = False)

Compressed representation of a distribution.

distogram.update(h: distogram.Distogram, value: float, count: int = 1) → distogram.Distogram

Adds a new element to the distribution.

Parameters:
  • h – A Distogram object.
  • value – The value to add on the histogram.
  • count – [Optional] The number of times that value must be added.
Returns:

A Distogram object where value as been processed.

Raises:

ValueError if count is not strictly positive.

distogram.merge(h1: distogram.Distogram, h2: distogram.Distogram) → distogram.Distogram

Merges two Distogram objects

Parameters:
  • h1 – First Distogram.
  • h2 – Second Distogram.
Returns:

A Distogram object being the composition of h1 and h2. The number of bins in this Distogram is equal to the number of bins in h1.

distogram.count_at(h: distogram.Distogram, value: float)

Counts the number of elements present in the distribution up to value.

Parameters:
  • h – A Distogram object.
  • value – The value up to what elements must be counted.
Returns:

An estimation of the real count, computed from the compressed representation of the distribution. Returns None if the Distogram object contains no element or value is outside of the distribution bounds.

distogram.count(h: distogram.Distogram) → float

Counts the number of elements in the distribution.

Parameters:h – A Distogram object.
Returns:The number of elements in the distribution.
distogram.bounds(h: distogram.Distogram) → Tuple[float, float]

Returns the min and max values of the distribution.

Parameters:h – A Distogram object.
Returns:A tuple containing the minimum and maximum values of the distribution.
distogram.mean(h: distogram.Distogram) → float

Returns the mean of the distribution.

Parameters:h – A Distogram object.
Returns:An estimation of the mean of the values in the distribution.
distogram.variance(h: distogram.Distogram) → float

Returns the variance of the distribution.

Parameters:h – A Distogram object.
Returns:An estimation of the variance of the values in the distribution.
distogram.stddev(h: distogram.Distogram) → float

Returns the standard deviation of the distribution.

Parameters:h – A Distogram object.
Returns:An estimation of the standard deviation of the values in the distribution.
distogram.histogram(h: distogram.Distogram, bin_count: int = 100) → Tuple[List[float], List[float]]

Returns a histogram of the distribution in numpy format.

Parameters:
  • h – A Distogram object.
  • bin_count – [Optional] The number of bins in the histogram.
Returns:

An estimation of the histogram of the distribution, or None if there is not enough items in the distribution.

distogram.frequency_density_distribution(h: distogram.Distogram) → Tuple[List[float], List[float]]

Returns a histogram of the distribution

Parameters:h – A Distogram object.
Returns:An estimation of the frequency density distribution, or None if there are not enough values in the distribution.
distogram.quantile(h: distogram.Distogram, value: float) → Optional[float]

Returns a quantile of the distribution

Parameters:
  • h – A Distogram object.
  • value – The quantile to compute. Must be between 0 and 1
Returns:

An estimation of the quantile. Returns None if the Distogram object contains no element or value is outside of [0, 1].