# boost_histogram

### *class* boost_histogram.Histogram(arg: [Histogram](#boost_histogram.histogram.Histogram)[S], , , metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ..., \_\_dict_\_: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ...)

### *class* boost_histogram.Histogram(arg: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [Any](https://docs.python.org/3/library/typing.html#typing.Any)], , , metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ..., \_\_dict_\_: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ...)

### *class* boost_histogram.Histogram(arg: [CppHistogram](#boost_histogram.typing.CppHistogram), , , metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ..., \_\_dict_\_: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ...)

### *class* boost_histogram.Histogram(\*axes: [Axis](#boost_histogram.axis.Axis) | CppAxis, storage: S, metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ..., \_\_dict_\_: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ...)

### *class* boost_histogram.Histogram(\*axes: [Axis](#boost_histogram.axis.Axis) | CppAxis, storage: [None](https://docs.python.org/3/builtins/constants.html#None) = ..., metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ..., \_\_dict_\_: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ...)

Bases: [`Generic`](https://docs.python.org/3/library/typing.html#typing.Generic)[`S`]

#### allclose(other: [object](https://docs.python.org/3/builtins/functions.html#object), , rtol: [float](https://docs.python.org/3/builtins/functions.html#float) = 1e-05, atol: [float](https://docs.python.org/3/builtins/functions.html#float) = 1e-08, equal_nan: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, metadata: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [bool](https://docs.python.org/3/builtins/functions.html#bool)

Check whether two histograms are close to each other.

* **Parameters:**
  * **other** ([*Histogram*](#boost_histogram.Histogram)) – The histogram to compare against.
  * **rtol** (*float = 1e-05*) – Relative tolerance for comparing edges and bins.
  * **atol** (*float = 1e-08*) – Absolute tolerance for comparing edges and bins.
  * **equal_nan** (*bool = False*) – Whether to compare NaNs as equal.
  * **flow** (*bool = True*) – Whether to include underflow and overflow bins in the comparison.
  * **metadata** (*bool = False*) – Whether to compare histogram and axis metadata.
* **Returns:**
  True if the histograms are close, False otherwise.
* **Return type:**
  [bool](https://docs.python.org/3/builtins/functions.html#bool)

#### axes *: [AxesTuple](#boost_histogram.axis.AxesTuple)*

#### copy(, deep: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True) → [Self](https://docs.python.org/3/library/typing.html#typing.Self)

Make a copy of the histogram. Defaults to making a
deep copy (axis metadata copied); use deep=False
to avoid making a copy of axis metadata.

#### counts(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[int64]

#### counts(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64]

#### counts(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64] | NDArray[int64]

Returns the number of entries in each bin for an unweighted
histogram or profile and an effective number of entries (defined below)
for a weighted histogram or profile. An exotic generalized histogram could
have no sensible .counts, so this is Optional and should be checked by
Consumers.

If kind == “MEAN”, counts (effective or not) can and should be used to
determine whether the mean value and its variance should be displayed
(see documentation of values and variances, respectively). The counts
should also be used to compute the error on the mean (see documentation
of variances).

For a weighted histogram, counts is defined as sum_of_weights \*\* 2 /
sum_of_weights_squared. It is equal or less than the number of times
the bin was filled, the equality holds when all filled weights are equal.
The larger the spread in weights, the smaller it is, but it is always 0
if filled 0 times, and 1 if filled once, and more than 1 otherwise.

* **Returns:**
  “np.typing.NDArray[Any]”[np.float64]

#### empty(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [bool](https://docs.python.org/3/builtins/functions.html#bool)

Check to see if the histogram has any non-default values.
You can use flow=True to check flow bins too.

#### fill(\*args: [ArrayLike](#boost_histogram.typing.ArrayLike) | [str](https://docs.python.org/3/builtins/stdtypes.html#str), weight: [ArrayLike](#boost_histogram.typing.ArrayLike) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, sample: [ArrayLike](#boost_histogram.typing.ArrayLike) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, threads: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → Self

Insert data into the histogram.

* **Parameters:**
  * **\*args** (*Union* *[**Array* *[*[*float*](https://docs.python.org/3/builtins/functions.html#float) *]* *,* *Array* *[*[*int*](https://docs.python.org/3/builtins/functions.html#int) *]* *,* *Array* *[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]* *,* [*float*](https://docs.python.org/3/builtins/functions.html#float) *,* [*int*](https://docs.python.org/3/builtins/functions.html#int) *,* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]*) – Provide one value or array per dimension.
  * **weight** ([*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[**Union* *[**Array* *[*[*float*](https://docs.python.org/3/builtins/functions.html#float) *]* *,* *Array* *[*[*int*](https://docs.python.org/3/builtins/functions.html#int) *]* *,* [*float*](https://docs.python.org/3/builtins/functions.html#float) *,* [*int*](https://docs.python.org/3/builtins/functions.html#int) *,* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]* *]* *]*) – Provide weights (only if the histogram storage supports it)
  * **sample** ([*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[**Union* *[**Array* *[*[*float*](https://docs.python.org/3/builtins/functions.html#float) *]* *,* *Array* *[*[*int*](https://docs.python.org/3/builtins/functions.html#int) *]* *,* *Array* *[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]* *,* [*float*](https://docs.python.org/3/builtins/functions.html#float) *,* [*int*](https://docs.python.org/3/builtins/functions.html#int) *,* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]* *]* *]*) – Provide samples (only if the histogram storage supports it)
  * **threads** (*Optional* *[*[*int*](https://docs.python.org/3/builtins/functions.html#int) *]*) – Fill with threads. Defaults to None, which does not activate
    threaded filling.  Using 0 will automatically pick the number of
    available threads (usually two per core). A continuous growth axis
    (such as a growing Regular axis) cannot be merged across threads
    yet, so such a fill raises instead.

#### *property* kind *: [Kind](#boost_histogram.histogram.Kind)*

Returns Kind.COUNT if this is a normal summing histogram, and Kind.MEAN if this is a
mean histogram.

* **Returns:**
  Kind

#### *property* ndim *: [int](https://docs.python.org/3/builtins/functions.html#int)*

Number of axes (dimensions) of the histogram.

#### project(\*args: [int](https://docs.python.org/3/builtins/functions.html#int), flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True) → [Self](https://docs.python.org/3/library/typing.html#typing.Self)

Project to a single axis or several axes on a multidimensional histogram.
Provided a list of axis numbers, this will produce the histogram over
those axes only. Flow bins are used if available. If flow is False,
flow bins on the integrated-out axes are excluded.

#### reset() → [Self](https://docs.python.org/3/library/typing.html#typing.Self)

Clear the bin counters.

#### *property* shape *: [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[int](https://docs.python.org/3/builtins/functions.html#int), ...]*

Tuple of axis sizes (not including underflow/overflow).

#### *property* size *: [int](https://docs.python.org/3/builtins/functions.html#int)*

Total number of bins in the histogram (including underflow/overflow).

#### *property* storage *: S*

New storage matching the one the histogram was constructed with.

#### *property* storage_type *: [type](https://docs.python.org/3/builtins/functions.html#type)[S]*

#### sum(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [float](https://docs.python.org/3/builtins/functions.html#float)

#### sum(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[float](https://docs.python.org/3/builtins/functions.html#float)]

#### sum(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [WeightedSum](#boost_histogram.typing.WeightedSum)

#### sum(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [Mean](#boost_histogram.storage.Mean)

#### sum(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [WeightedMean](#boost_histogram.storage.WeightedMean)

#### sum(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [float](https://docs.python.org/3/builtins/functions.html#float) | [Accumulator](#boost_histogram.accumulators.Accumulator) | [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[float](https://docs.python.org/3/builtins/functions.html#float)]

Compute the sum over the histogram bins (optionally including the flow bins).

#### to_numpy(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, , dd: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)[False] = False, view: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)], ...]

#### to_numpy(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, , dd: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)[True], view: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)], [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[NDArray[float64], ...]]

#### to_numpy(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, , dd: [bool](https://docs.python.org/3/builtins/functions.html#bool), view: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)], ...] | [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)], [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[NDArray[float64], ...]]

Convert to a NumPy style tuple of return arrays. Edges are converted to
match NumPy standards, with upper edge inclusive, unlike
boost-histogram, where upper edge is exclusive.

* **Parameters:**
  * **flow** (*bool = False*) – Include the flow bins.
  * **dd** (*bool = False*) – Use the histogramdd return syntax, where the edges are in a tuple.
    Otherwise, this is the histogram/histogram2d return style.
  * **view** (*bool  = False*) – The behavior for the return value. By default, this will return
    array of the values only regardless of the storage (which is all
    NumPy’s histogram function can do). view=True will return the
    boost-histogram view of the storage.
* **Returns:**
  * **contents** (*Array[Any]*) – The bin contents
  * **\*edges** (*Array[float]*) – The edges for each dimension

#### values(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[int64]

#### values(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64]

#### values(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64] | NDArray[int64]

Returns the accumulated values. The counts for simple histograms, the
sum of weights for weighted histograms, the mean for profiles, etc.

If counts is equal to 0, the value in that cell is undefined if
kind == “MEAN”.

* **Parameters:**
  **flow** – Enable flow bins. Not part of PlottableHistogram, but

included for consistency with other methods and flexibility.

* **Returns:**
  “np.typing.NDArray[Any]”[np.float64]

#### variances(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[int64] | [None](https://docs.python.org/3/builtins/constants.html#None)

#### variances(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64] | [None](https://docs.python.org/3/builtins/constants.html#None)

#### variances(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64]

#### variances(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[int64] | NDArray[float64] | [None](https://docs.python.org/3/builtins/constants.html#None)

Returns the estimated variance of the accumulated values. The sum of squared
weights for weighted histograms, the variance of samples for profiles, etc.
For an unweighed histogram where kind == “COUNT”, this should return the same
as values if the histogram was not filled with weights, and None otherwise.
If counts is equal to 1 or less, the variance in that cell is undefined if
kind == “MEAN”. This must be written <= 1, and not < 2; when this
effective counts (weighed mean), then counts could be less than 2 but
more than 1.

If kind == “MEAN”, the counts can be used to compute the error on the mean
as sqrt(variances / counts), this works whether or not the entries are
weighted if the weight variance was tracked by the implementation.

Currently, this always returns - but in the future, it will return None
if a weighted fill is made on a unweighed storage.

* **Parameters:**
  **flow** – Enable flow bins. Not part of PlottableHistogram, but

included for consistency with other methods and flexibility.

* **Returns:**
  “np.typing.NDArray[Any]”[np.float64]

#### view(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64]

#### view(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[int64]

#### view(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [WeightedSumView](#boost_histogram.view.WeightedSumView)

#### view(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [MeanView](#boost_histogram.view.MeanView)

#### view(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [WeightedMeanView](#boost_histogram.view.WeightedMeanView)

#### view(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64] | NDArray[int64] | [WeightedSumView](#boost_histogram.view.WeightedSumView) | [WeightedMeanView](#boost_histogram.view.WeightedMeanView) | [MeanView](#boost_histogram.view.MeanView)

Return a view into the data, optionally with overflow turned on.

The view shares memory with the histogram. If the histogram has a
growth axis, a fill that grows an axis moves the data, and the view
then points at freed memory. Take a copy before such a fill.

### *class* boost_histogram.Kind(\*values)

Bases: [`StrEnum`](https://docs.python.org/3/library/enum.html#enum.StrEnum)

#### COUNT *= 'COUNT'*

#### MEAN *= 'MEAN'*

### *class* boost_histogram.loc(value: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [float](https://docs.python.org/3/builtins/functions.html#float), offset: [int](https://docs.python.org/3/builtins/functions.html#int) = 0)

Bases: [`Locator`](#boost_histogram.tag.Locator)

#### value

### *class* boost_histogram.rebin(factor_or_axis: [int](https://docs.python.org/3/builtins/functions.html#int) | PlottableAxis | [None](https://docs.python.org/3/builtins/constants.html#None) = None, , , factor: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, groups: Sequence[[int](https://docs.python.org/3/builtins/functions.html#int)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, edges: Sequence[[int](https://docs.python.org/3/builtins/functions.html#int) | [float](https://docs.python.org/3/builtins/functions.html#float)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, axis: PlottableAxis | [None](https://docs.python.org/3/builtins/constants.html#None) = None)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

#### axis

#### axis_mapping(axis: PlottableAxis) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[Sequence[[int](https://docs.python.org/3/builtins/functions.html#int)], PlottableAxis | [None](https://docs.python.org/3/builtins/constants.html#None)]

#### edges

#### factor

#### group_mapping(axis: PlottableAxis) → Sequence[[int](https://docs.python.org/3/builtins/functions.html#int)]

Return the list of group sizes (numbers of adjacent bins to merge)
for `axis`. For explicit groups, the sum of the group sizes must
equal the number of bins in the axis. For a factor, this returns
`len(axis) // factor` groups of size `factor`; if the factor does
not divide the number of bins evenly, the leftover bins are not part
of any group (a consumer should merge them into the overflow bin,
matching the C++ factor-based rebinning).

#### groups

### boost_histogram.sum(iterable, , start=0)

Return the sum of a ‘start’ value (default: 0) plus an iterable of numbers

When the iterable is empty, return the start value.
This function is intended specifically for use with numeric values and may
reject non-numeric types.

# boost_histogram.axis

### *class* boost_histogram.axis.ArrayTuple(iterable=(),)

Bases: [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple)

#### broadcast() → [Self](https://docs.python.org/3/library/typing.html#typing.Self)

The arrays in this tuple will be compressed if possible to save memory.
Use this method to broadcast them out into their full memory
representation.

### *class* boost_histogram.axis.AxesTuple(\_iterable: [Iterable](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)[[Axis](#boost_histogram.axis.Axis)])

Bases: [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple)

#### bin(\*indexes: [float](https://docs.python.org/3/builtins/functions.html#float)) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[float](https://docs.python.org/3/builtins/functions.html#float), ...]

Return the edges of the bins as a tuple for a
continuous axis or the bin value for a
non-continuous axis, when given an index.

#### *property* centers *: [ArrayTuple](#boost_histogram.axis.ArrayTuple)*

#### *property* edges *: [ArrayTuple](#boost_histogram.axis.ArrayTuple)*

#### *property* extent *: [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[int](https://docs.python.org/3/builtins/functions.html#int), ...]*

#### index(\*values: [float](https://docs.python.org/3/builtins/functions.html#float)) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[int](https://docs.python.org/3/builtins/functions.html#int), ...]

Return the fractional index(es) given a value (or values) on the axis.

#### *property* size *: [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[int](https://docs.python.org/3/builtins/functions.html#int), ...]*

#### value(\*indexes: [float](https://docs.python.org/3/builtins/functions.html#float)) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[float](https://docs.python.org/3/builtins/functions.html#float), ...]

Return the value(s) given an (fractional) index (or indices).

#### *property* widths *: [ArrayTuple](#boost_histogram.axis.ArrayTuple)*

### *class* boost_histogram.axis.Axis(ax: [Any](https://docs.python.org/3/library/typing.html#typing.Any), metadata: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [Any](https://docs.python.org/3/library/typing.html#typing.Any)] | [None](https://docs.python.org/3/builtins/constants.html#None), \_\_dict_\_: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [Any](https://docs.python.org/3/library/typing.html#typing.Any)] | [None](https://docs.python.org/3/builtins/constants.html#None))

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

#### bin(index: [float](https://docs.python.org/3/builtins/functions.html#float)) → [int](https://docs.python.org/3/builtins/functions.html#int) | [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[float](https://docs.python.org/3/builtins/functions.html#float), [float](https://docs.python.org/3/builtins/functions.html#float)]

Return the edges of the bins as a tuple for a
continuous axis or the bin value for a
non-continuous axis, when given an index.

#### *property* centers *: NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)]*

An array of bin centers.

#### *property* edges *: NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)]*

#### *property* extent *: [int](https://docs.python.org/3/builtins/functions.html#int)*

Return number of bins including under- and overflow.

#### index(value: [float](https://docs.python.org/3/builtins/functions.html#float) | [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [int](https://docs.python.org/3/builtins/functions.html#int)

Return the fractional index(es) given a value (or values) on the axis.

#### *property* size *: [int](https://docs.python.org/3/builtins/functions.html#int)*

Return number of bins excluding under- and overflow.

#### *property* traits *: [Traits](#boost_histogram.axis.Traits)*

Get traits for the axis - read only properties of a specific axis.

#### value(index: [float](https://docs.python.org/3/builtins/functions.html#float)) → [float](https://docs.python.org/3/builtins/functions.html#float)

Return the value(s) given an (fractional) index (or indices).

#### *property* widths *: NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)]*

An array of bin widths.

### *class* boost_histogram.axis.Boolean(, metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = None, \_\_dict_\_: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [Any](https://docs.python.org/3/library/typing.html#typing.Any)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None)

Bases: [`Axis`](#boost_histogram.axis.Axis)

### *class* boost_histogram.axis.IntCategory(categories: [Iterable](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)[[int](https://docs.python.org/3/builtins/functions.html#int)], , metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = None, growth: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, overflow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, \_\_dict_\_: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [Any](https://docs.python.org/3/library/typing.html#typing.Any)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None)

Bases: `BaseCategory`

### *class* boost_histogram.axis.Integer(start: [int](https://docs.python.org/3/builtins/functions.html#int), stop: [int](https://docs.python.org/3/builtins/functions.html#int), , metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = None, underflow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, overflow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, growth: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, circular: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, \_\_dict_\_: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [Any](https://docs.python.org/3/library/typing.html#typing.Any)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None)

Bases: [`Axis`](#boost_histogram.axis.Axis)

### *class* boost_histogram.axis.Regular(bins: [int](https://docs.python.org/3/builtins/functions.html#int), start: [float](https://docs.python.org/3/builtins/functions.html#float), stop: [float](https://docs.python.org/3/builtins/functions.html#float), , metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = None, underflow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, overflow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, growth: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, circular: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, transform: [AxisTransform](#boost_histogram.axis.transform.AxisTransform) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, \_\_dict_\_: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [Any](https://docs.python.org/3/library/typing.html#typing.Any)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None)

Bases: [`Axis`](#boost_histogram.axis.Axis)

#### *property* transform *: [AxisTransform](#boost_histogram.axis.transform.AxisTransform) | [None](https://docs.python.org/3/builtins/constants.html#None)*

### *class* boost_histogram.axis.StrCategory(categories: [Iterable](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)], , metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = None, growth: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, overflow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, \_\_dict_\_: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [Any](https://docs.python.org/3/library/typing.html#typing.Any)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None)

Bases: `BaseCategory`

#### index(value: [float](https://docs.python.org/3/builtins/functions.html#float) | [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [int](https://docs.python.org/3/builtins/functions.html#int)

Return the fractional index(es) given a value (or values) on the axis.

### *class* boost_histogram.axis.Traits(underflow: 'bool' = False, overflow: 'bool' = False, circular: 'bool' = False, growth: 'bool' = False, continuous: 'bool' = False, ordered: 'bool' = False)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

#### circular *: [bool](https://docs.python.org/3/builtins/functions.html#bool)* *= False*

#### continuous *: [bool](https://docs.python.org/3/builtins/functions.html#bool)* *= False*

#### *property* discrete *: [bool](https://docs.python.org/3/builtins/functions.html#bool)*

True if axis is not continuous

#### growth *: [bool](https://docs.python.org/3/builtins/functions.html#bool)* *= False*

#### ordered *: [bool](https://docs.python.org/3/builtins/functions.html#bool)* *= False*

#### overflow *: [bool](https://docs.python.org/3/builtins/functions.html#bool)* *= False*

#### underflow *: [bool](https://docs.python.org/3/builtins/functions.html#bool)* *= False*

### *class* boost_histogram.axis.Variable(edges: [Iterable](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable)[[float](https://docs.python.org/3/builtins/functions.html#float)], , metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = None, underflow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, overflow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, growth: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, circular: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, \_\_dict_\_: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [Any](https://docs.python.org/3/library/typing.html#typing.Any)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None)

Bases: [`Axis`](#boost_histogram.axis.Axis)

# boost_histogram.axis.transform

### *class* boost_histogram.axis.transform.AxisTransform

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

#### forward(value: [float](https://docs.python.org/3/builtins/functions.html#float)) → [float](https://docs.python.org/3/builtins/functions.html#float)

Compute the forward transform

#### inverse(value: [float](https://docs.python.org/3/builtins/functions.html#float)) → [float](https://docs.python.org/3/builtins/functions.html#float)

Compute the inverse transform

### *class* boost_histogram.axis.transform.Function(forward: [Any](https://docs.python.org/3/library/typing.html#typing.Any), inverse: [Any](https://docs.python.org/3/library/typing.html#typing.Any), , convert: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = None, name: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = '')

Bases: [`AxisTransform`](#boost_histogram.axis.transform.AxisTransform)

### *class* boost_histogram.axis.transform.Pow(power: [float](https://docs.python.org/3/builtins/functions.html#float))

Bases: [`AxisTransform`](#boost_histogram.axis.transform.AxisTransform)

#### *property* power *: [float](https://docs.python.org/3/builtins/functions.html#float)*

The power of the transform

# boost_histogram.accumulators

### boost_histogram.accumulators.Accumulator

alias of [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)

# boost_histogram.histogram

### *class* boost_histogram.histogram.Histogram(arg: [Histogram](#boost_histogram.histogram.Histogram)[S], , , metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ..., \_\_dict_\_: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ...)

### *class* boost_histogram.histogram.Histogram(arg: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [Any](https://docs.python.org/3/library/typing.html#typing.Any)], , , metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ..., \_\_dict_\_: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ...)

### *class* boost_histogram.histogram.Histogram(arg: [CppHistogram](#boost_histogram.typing.CppHistogram), , , metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ..., \_\_dict_\_: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ...)

### *class* boost_histogram.histogram.Histogram(\*axes: [Axis](#boost_histogram.axis.Axis) | CppAxis, storage: S, metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ..., \_\_dict_\_: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ...)

### *class* boost_histogram.histogram.Histogram(\*axes: [Axis](#boost_histogram.axis.Axis) | CppAxis, storage: [None](https://docs.python.org/3/builtins/constants.html#None) = ..., metadata: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ..., \_\_dict_\_: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = ...)

Bases: [`Generic`](https://docs.python.org/3/library/typing.html#typing.Generic)[`S`]

#### allclose(other: [object](https://docs.python.org/3/builtins/functions.html#object), , rtol: [float](https://docs.python.org/3/builtins/functions.html#float) = 1e-05, atol: [float](https://docs.python.org/3/builtins/functions.html#float) = 1e-08, equal_nan: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, metadata: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [bool](https://docs.python.org/3/builtins/functions.html#bool)

Check whether two histograms are close to each other.

* **Parameters:**
  * **other** ([*Histogram*](#boost_histogram.histogram.Histogram)) – The histogram to compare against.
  * **rtol** (*float = 1e-05*) – Relative tolerance for comparing edges and bins.
  * **atol** (*float = 1e-08*) – Absolute tolerance for comparing edges and bins.
  * **equal_nan** (*bool = False*) – Whether to compare NaNs as equal.
  * **flow** (*bool = True*) – Whether to include underflow and overflow bins in the comparison.
  * **metadata** (*bool = False*) – Whether to compare histogram and axis metadata.
* **Returns:**
  True if the histograms are close, False otherwise.
* **Return type:**
  [bool](https://docs.python.org/3/builtins/functions.html#bool)

#### axes *: [AxesTuple](#boost_histogram.axis.AxesTuple)*

#### copy(, deep: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True) → [Self](https://docs.python.org/3/library/typing.html#typing.Self)

Make a copy of the histogram. Defaults to making a
deep copy (axis metadata copied); use deep=False
to avoid making a copy of axis metadata.

#### counts(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[int64]

#### counts(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64]

#### counts(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64] | NDArray[int64]

Returns the number of entries in each bin for an unweighted
histogram or profile and an effective number of entries (defined below)
for a weighted histogram or profile. An exotic generalized histogram could
have no sensible .counts, so this is Optional and should be checked by
Consumers.

If kind == “MEAN”, counts (effective or not) can and should be used to
determine whether the mean value and its variance should be displayed
(see documentation of values and variances, respectively). The counts
should also be used to compute the error on the mean (see documentation
of variances).

For a weighted histogram, counts is defined as sum_of_weights \*\* 2 /
sum_of_weights_squared. It is equal or less than the number of times
the bin was filled, the equality holds when all filled weights are equal.
The larger the spread in weights, the smaller it is, but it is always 0
if filled 0 times, and 1 if filled once, and more than 1 otherwise.

* **Returns:**
  “np.typing.NDArray[Any]”[np.float64]

#### empty(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [bool](https://docs.python.org/3/builtins/functions.html#bool)

Check to see if the histogram has any non-default values.
You can use flow=True to check flow bins too.

#### fill(\*args: [ArrayLike](#boost_histogram.typing.ArrayLike) | [str](https://docs.python.org/3/builtins/stdtypes.html#str), weight: [ArrayLike](#boost_histogram.typing.ArrayLike) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, sample: [ArrayLike](#boost_histogram.typing.ArrayLike) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, threads: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → Self

Insert data into the histogram.

* **Parameters:**
  * **\*args** (*Union* *[**Array* *[*[*float*](https://docs.python.org/3/builtins/functions.html#float) *]* *,* *Array* *[*[*int*](https://docs.python.org/3/builtins/functions.html#int) *]* *,* *Array* *[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]* *,* [*float*](https://docs.python.org/3/builtins/functions.html#float) *,* [*int*](https://docs.python.org/3/builtins/functions.html#int) *,* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]*) – Provide one value or array per dimension.
  * **weight** ([*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[**Union* *[**Array* *[*[*float*](https://docs.python.org/3/builtins/functions.html#float) *]* *,* *Array* *[*[*int*](https://docs.python.org/3/builtins/functions.html#int) *]* *,* [*float*](https://docs.python.org/3/builtins/functions.html#float) *,* [*int*](https://docs.python.org/3/builtins/functions.html#int) *,* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]* *]* *]*) – Provide weights (only if the histogram storage supports it)
  * **sample** ([*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[**Union* *[**Array* *[*[*float*](https://docs.python.org/3/builtins/functions.html#float) *]* *,* *Array* *[*[*int*](https://docs.python.org/3/builtins/functions.html#int) *]* *,* *Array* *[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]* *,* [*float*](https://docs.python.org/3/builtins/functions.html#float) *,* [*int*](https://docs.python.org/3/builtins/functions.html#int) *,* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]* *]* *]*) – Provide samples (only if the histogram storage supports it)
  * **threads** (*Optional* *[*[*int*](https://docs.python.org/3/builtins/functions.html#int) *]*) – Fill with threads. Defaults to None, which does not activate
    threaded filling.  Using 0 will automatically pick the number of
    available threads (usually two per core). A continuous growth axis
    (such as a growing Regular axis) cannot be merged across threads
    yet, so such a fill raises instead.

#### *property* kind *: [Kind](#boost_histogram.histogram.Kind)*

Returns Kind.COUNT if this is a normal summing histogram, and Kind.MEAN if this is a
mean histogram.

* **Returns:**
  Kind

#### *property* ndim *: [int](https://docs.python.org/3/builtins/functions.html#int)*

Number of axes (dimensions) of the histogram.

#### project(\*args: [int](https://docs.python.org/3/builtins/functions.html#int), flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True) → [Self](https://docs.python.org/3/library/typing.html#typing.Self)

Project to a single axis or several axes on a multidimensional histogram.
Provided a list of axis numbers, this will produce the histogram over
those axes only. Flow bins are used if available. If flow is False,
flow bins on the integrated-out axes are excluded.

#### reset() → [Self](https://docs.python.org/3/library/typing.html#typing.Self)

Clear the bin counters.

#### *property* shape *: [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[int](https://docs.python.org/3/builtins/functions.html#int), ...]*

Tuple of axis sizes (not including underflow/overflow).

#### *property* size *: [int](https://docs.python.org/3/builtins/functions.html#int)*

Total number of bins in the histogram (including underflow/overflow).

#### *property* storage *: S*

New storage matching the one the histogram was constructed with.

#### *property* storage_type *: [type](https://docs.python.org/3/builtins/functions.html#type)[S]*

#### sum(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [float](https://docs.python.org/3/builtins/functions.html#float)

#### sum(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[float](https://docs.python.org/3/builtins/functions.html#float)]

#### sum(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [WeightedSum](#boost_histogram.typing.WeightedSum)

#### sum(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [Mean](#boost_histogram.storage.Mean)

#### sum(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [WeightedMean](#boost_histogram.storage.WeightedMean)

#### sum(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [float](https://docs.python.org/3/builtins/functions.html#float) | [Accumulator](#boost_histogram.accumulators.Accumulator) | [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[float](https://docs.python.org/3/builtins/functions.html#float)]

Compute the sum over the histogram bins (optionally including the flow bins).

#### to_numpy(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, , dd: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)[False] = False, view: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)], ...]

#### to_numpy(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, , dd: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)[True], view: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)], [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[NDArray[float64], ...]]

#### to_numpy(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, , dd: [bool](https://docs.python.org/3/builtins/functions.html#bool), view: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)], ...] | [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)], [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[NDArray[float64], ...]]

Convert to a NumPy style tuple of return arrays. Edges are converted to
match NumPy standards, with upper edge inclusive, unlike
boost-histogram, where upper edge is exclusive.

* **Parameters:**
  * **flow** (*bool = False*) – Include the flow bins.
  * **dd** (*bool = False*) – Use the histogramdd return syntax, where the edges are in a tuple.
    Otherwise, this is the histogram/histogram2d return style.
  * **view** (*bool  = False*) – The behavior for the return value. By default, this will return
    array of the values only regardless of the storage (which is all
    NumPy’s histogram function can do). view=True will return the
    boost-histogram view of the storage.
* **Returns:**
  * **contents** (*Array[Any]*) – The bin contents
  * **\*edges** (*Array[float]*) – The edges for each dimension

#### values(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[int64]

#### values(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64]

#### values(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64] | NDArray[int64]

Returns the accumulated values. The counts for simple histograms, the
sum of weights for weighted histograms, the mean for profiles, etc.

If counts is equal to 0, the value in that cell is undefined if
kind == “MEAN”.

* **Parameters:**
  **flow** – Enable flow bins. Not part of PlottableHistogram, but

included for consistency with other methods and flexibility.

* **Returns:**
  “np.typing.NDArray[Any]”[np.float64]

#### variances(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[int64] | [None](https://docs.python.org/3/builtins/constants.html#None)

#### variances(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64] | [None](https://docs.python.org/3/builtins/constants.html#None)

#### variances(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64]

#### variances(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[int64] | NDArray[float64] | [None](https://docs.python.org/3/builtins/constants.html#None)

Returns the estimated variance of the accumulated values. The sum of squared
weights for weighted histograms, the variance of samples for profiles, etc.
For an unweighed histogram where kind == “COUNT”, this should return the same
as values if the histogram was not filled with weights, and None otherwise.
If counts is equal to 1 or less, the variance in that cell is undefined if
kind == “MEAN”. This must be written <= 1, and not < 2; when this
effective counts (weighed mean), then counts could be less than 2 but
more than 1.

If kind == “MEAN”, the counts can be used to compute the error on the mean
as sqrt(variances / counts), this works whether or not the entries are
weighted if the weight variance was tracked by the implementation.

Currently, this always returns - but in the future, it will return None
if a weighted fill is made on a unweighed storage.

* **Parameters:**
  **flow** – Enable flow bins. Not part of PlottableHistogram, but

included for consistency with other methods and flexibility.

* **Returns:**
  “np.typing.NDArray[Any]”[np.float64]

#### view(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64]

#### view(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[int64]

#### view(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [WeightedSumView](#boost_histogram.view.WeightedSumView)

#### view(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [MeanView](#boost_histogram.view.MeanView)

#### view(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [WeightedMeanView](#boost_histogram.view.WeightedMeanView)

#### view(flow: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → NDArray[float64] | NDArray[int64] | [WeightedSumView](#boost_histogram.view.WeightedSumView) | [WeightedMeanView](#boost_histogram.view.WeightedMeanView) | [MeanView](#boost_histogram.view.MeanView)

Return a view into the data, optionally with overflow turned on.

The view shares memory with the histogram. If the histogram has a
growth axis, a fill that grows an axis moves the data, and the view
then points at freed memory. Take a copy before such a fill.

### *class* boost_histogram.histogram.Kind(\*values)

Bases: [`StrEnum`](https://docs.python.org/3/library/enum.html#enum.StrEnum)

#### COUNT *= 'COUNT'*

#### MEAN *= 'MEAN'*

# boost_histogram.numpy

### boost_histogram.numpy.histogram(a: [object](https://docs.python.org/3/builtins/functions.html#object), bins: [int](https://docs.python.org/3/builtins/functions.html#int) | [str](https://docs.python.org/3/builtins/stdtypes.html#str) | NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)] = 10, range: [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[float](https://docs.python.org/3/builtins/functions.html#float), [float](https://docs.python.org/3/builtins/functions.html#float)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, normed: [None](https://docs.python.org/3/builtins/constants.html#None) = None, weights: [object](https://docs.python.org/3/builtins/functions.html#object) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, density: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, , histogram: [type](https://docs.python.org/3/builtins/functions.html#type)[[Histogram](#boost_histogram.histogram.Histogram)[[Any](https://docs.python.org/3/library/typing.html#typing.Any)]] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, storage: [Storage](#boost_histogram.storage.Storage) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, threads: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [Any](https://docs.python.org/3/library/typing.html#typing.Any)

Return a boost-histogram object using the same arguments as numpy’s histogram.
This does not support the deprecated normed=True argument. Three extra
arguments are added: histogram=bh.Histogram will enable object based
output, storage=bh.storage.\* lets you set the storage used, and threads=int
lets you set the number of threads to fill with (0 for auto, None for 1).

Compute the histogram of a dataset.

* **Parameters:**
  * **a** (*array_like*) – Input data. The histogram is computed over the flattened array.
  * **bins** ([*int*](https://docs.python.org/3/builtins/functions.html#int) *or* *sequence* *of* *scalars* *or* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *,* *optional*) – 

    If bins is an int, it defines the number of equal-width
    bins in the given range (10, by default). If bins is a
    sequence, it defines a monotonically increasing array of bin edges,
    including the rightmost edge, allowing for non-uniform bin widths.

    If bins is a string, it defines the method used to calculate the
    optimal bin width, as defined by histogram_bin_edges.
  * **range** ( *(*[*float*](https://docs.python.org/3/builtins/functions.html#float) *,* [*float*](https://docs.python.org/3/builtins/functions.html#float) *)* *,* *optional*) – The lower and upper range of the bins.  If not provided, range
    is simply `(a.min(), a.max())`.  Values outside the range are
    ignored. The first element of the range must be less than or
    equal to the second. range affects the automatic bin
    computation as well. While bin width is computed to be optimal
    based on the actual data within range, the bin count will fill
    the entire range including portions containing no data.
  * **weights** (*array_like* *,* *optional*) – An array of weights, of the same shape as a.  Each value in
    a only contributes its associated weight towards the bin count
    (instead of 1). If density is True, the weights are
    normalized, so that the integral of the density over the range
    remains 1.
    Please note that the `dtype` of weights will also become the
    `dtype` of the returned accumulator (hist), so it must be
    large enough to hold accumulated values as well.
  * **density** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool) *,* *optional*) – If `False`, the result will contain the number of samples in
    each bin. If `True`, the result is the value of the
    probability *density* function at the bin, normalized such that
    the *integral* over the range is 1. Note that the sum of the
    histogram values will not be equal to 1 unless bins of unity
    width are chosen; it is not a probability *mass* function.
* **Returns:**
  * **hist** (*array*) – The values of the histogram. See density and weights for a
    description of the possible semantics.  If weights are given,
    `hist.dtype` will be taken from weights.
  * **bin_edges** (*array of dtype float*) – Return the bin edges `(length(hist)+1)`.

#### SEE ALSO
[`histogramdd`](#boost_histogram.numpy.histogramdd), `bincount`, `searchsorted`, `digitize`, `histogram_bin_edges`

### Notes

All but the last (righthand-most) bin is half-open.  In other words,
if bins is:

```python3
[1, 2, 3, 4]
```

then the first bin is `[1, 2)` (including 1, but excluding 2) and
the second `[2, 3)`.  The last bin, however, is `[3, 4]`, which
*includes* 4.

### Examples

```pycon
>>> import numpy as np
>>> np.histogram([1, 2, 1], bins=[0, 1, 2, 3])
(array([0, 2, 1]), array([0, 1, 2, 3]))
>>> np.histogram(np.arange(4), bins=np.arange(5), density=True)
(array([0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4]))
>>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3])
(array([1, 4, 1]), array([0, 1, 2, 3]))
```

```pycon
>>> a = np.arange(5)
>>> hist, bin_edges = np.histogram(a, density=True)
>>> hist
array([0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5])
>>> hist.sum()
2.4999999999999996
>>> np.sum(hist * np.diff(bin_edges))
1.0
```

Automated Bin Selection Methods example, using 2 peak random data
with 2000 points.

### boost_histogram.numpy.histogram2d(x: [object](https://docs.python.org/3/builtins/functions.html#object), y: [object](https://docs.python.org/3/builtins/functions.html#object), bins: [int](https://docs.python.org/3/builtins/functions.html#int) | [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[int](https://docs.python.org/3/builtins/functions.html#int), [int](https://docs.python.org/3/builtins/functions.html#int)] = 10, range: [Sequence](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence)[[tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[float](https://docs.python.org/3/builtins/functions.html#float), [float](https://docs.python.org/3/builtins/functions.html#float)] | [None](https://docs.python.org/3/builtins/constants.html#None)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, normed: [None](https://docs.python.org/3/builtins/constants.html#None) = None, weights: [object](https://docs.python.org/3/builtins/functions.html#object) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, density: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, , histogram: [type](https://docs.python.org/3/builtins/functions.html#type)[[Histogram](#boost_histogram.histogram.Histogram)[[Any](https://docs.python.org/3/library/typing.html#typing.Any)]] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, storage: [Storage](#boost_histogram.storage.Storage) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, threads: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [Any](https://docs.python.org/3/library/typing.html#typing.Any)

Return a boost-histogram object using the same arguments as numpy’s histogram2d.
This does not support the deprecated normed=True argument. Three extra
arguments are added: histogram=bh.Histogram will enable object based
output, storage=bh.storage.\* lets you set the storage used, and threads=int
lets you set the number of threads to fill with (0 for auto, None for 1).

Compute the bi-dimensional histogram of two data samples.

* **Parameters:**
  * **x** (*array_like* *,* [*shape*](#boost_histogram.Histogram.shape) *(**N* *,* *)*) – An array containing the x coordinates of the points to be
    histogrammed.
  * **y** (*array_like* *,* [*shape*](#boost_histogram.Histogram.shape) *(**N* *,* *)*) – An array containing the y coordinates of the points to be
    histogrammed.
  * **bins** ([*int*](https://docs.python.org/3/builtins/functions.html#int) *or* *array_like* *or*  *[*[*int*](https://docs.python.org/3/builtins/functions.html#int) *,* [*int*](https://docs.python.org/3/builtins/functions.html#int) *] or*  *[**array* *,* *array* *]* *,* *optional*) – 

    The bin specification:
    * If int, the number of bins for the two dimensions (nx=ny=bins).
    * If array_like, the bin edges for the two dimensions
      (x_edges=y_edges=bins).
    * If [int, int], the number of bins in each dimension
      (nx, ny = bins).
    * If [array, array], the bin edges in each dimension
      (x_edges, y_edges = bins).
    * A combination [int, array] or [array, int], where int
      is the number of bins and array is the bin edges.
  * **range** (*array_like* *,* [*shape*](#boost_histogram.Histogram.shape) *(**2* *,**2* *)* *,* *optional*) – The leftmost and rightmost edges of the bins along each dimension
    (if not specified explicitly in the bins parameters):
    `[[xmin, xmax], [ymin, ymax]]`. All values outside of this range
    will be considered outliers and not tallied in the histogram.
  * **density** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool) *,* *optional*) – If False, the default, returns the number of samples in each bin.
    If True, returns the probability *density* function at the bin,
    `bin_count / sample_count / bin_area`.
  * **weights** (*array_like* *,* [*shape*](#boost_histogram.Histogram.shape) *(**N* *,* *)* *,* *optional*) – An array of values `w_i` weighing each sample `(x_i, y_i)`.
    Weights are normalized to 1 if density is True. If density is
    False, the values of the returned histogram are equal to the sum of
    the weights belonging to the samples falling into each bin.
* **Returns:**
  * **H** (*ndarray, shape(nx, ny)*) – The bi-dimensional histogram of samples x and y. Values in x
    are histogrammed along the first dimension and values in y are
    histogrammed along the second dimension.
  * **xedges** (*ndarray, shape(nx+1,)*) – The bin edges along the first dimension.
  * **yedges** (*ndarray, shape(ny+1,)*) – The bin edges along the second dimension.

#### SEE ALSO
[`histogram`](#boost_histogram.numpy.histogram)
: 1D histogram

[`histogramdd`](#boost_histogram.numpy.histogramdd)
: Multidimensional histogram

### Notes

When density is True, then the returned histogram is the sample
density, defined such that the sum over bins of the product
`bin_value * bin_area` is 1.

Please note that the histogram does not follow the Cartesian convention
where x values are on the abscissa and y values on the ordinate
axis.  Rather, x is histogrammed along the first dimension of the
array (vertical), and y along the second dimension of the array
(horizontal).  This ensures compatibility with histogramdd.

### Examples

```pycon
>>> import numpy as np
>>> from matplotlib.image import NonUniformImage
>>> import matplotlib.pyplot as plt
```

Construct a 2-D histogram with variable bin width. First define the bin
edges:

```pycon
>>> xedges = [0, 1, 3, 5]
>>> yedges = [0, 2, 3, 4, 6]
```

Next we create a histogram H with random bin content:

```pycon
>>> x = np.random.normal(2, 1, 100)
>>> y = np.random.normal(1, 1, 100)
>>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges))
>>> # Histogram does not follow Cartesian convention (see Notes),
>>> # therefore transpose H for visualization purposes.
>>> H = H.T
```

`imshow` can only display square bins:

```pycon
>>> fig = plt.figure(figsize=(7, 3))
>>> ax = fig.add_subplot(131, title='imshow: square bins')
>>> plt.imshow(H, interpolation='nearest', origin='lower',
...         extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]])
<matplotlib.image.AxesImage object at 0x...>
```

`pcolormesh` can display actual edges:

```pycon
>>> ax = fig.add_subplot(132, title='pcolormesh: actual edges',
...         aspect='equal')
>>> X, Y = np.meshgrid(xedges, yedges)
>>> ax.pcolormesh(X, Y, H)
<matplotlib.collections.QuadMesh object at 0x...>
```

`NonUniformImage` can be used to
display actual bin edges with interpolation:

```pycon
>>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated',
...         aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]])
>>> im = NonUniformImage(ax, interpolation='bilinear')
>>> xcenters = (xedges[:-1] + xedges[1:]) / 2
>>> ycenters = (yedges[:-1] + yedges[1:]) / 2
>>> im.set_data(xcenters, ycenters, H)
>>> ax.add_image(im)
>>> plt.show()
```

It is also possible to construct a 2-D histogram without specifying bin
edges:

```pycon
>>> # Generate non-symmetric test data
>>> n = 10000
>>> x = np.linspace(1, 100, n)
>>> y = 2*np.log(x) + np.random.rand(n) - 0.5
>>> # Compute 2d histogram. Note the order of x/y and xedges/yedges
>>> H, yedges, xedges = np.histogram2d(y, x, bins=20)
```

Now we can plot the histogram using
`pcolormesh`, and a
`hexbin` for comparison.

```pycon
>>> # Plot histogram using pcolormesh
>>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True)
>>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow')
>>> ax1.plot(x, 2*np.log(x), 'k-')
>>> ax1.set_xlim(x.min(), x.max())
>>> ax1.set_ylim(y.min(), y.max())
>>> ax1.set_xlabel('x')
>>> ax1.set_ylabel('y')
>>> ax1.set_title('histogram2d')
>>> ax1.grid()
```

```pycon
>>> # Create hexbin plot for comparison
>>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow')
>>> ax2.plot(x, 2*np.log(x), 'k-')
>>> ax2.set_title('hexbin')
>>> ax2.set_xlim(x.min(), x.max())
>>> ax2.set_xlabel('x')
>>> ax2.grid()
```

```pycon
>>> plt.show()
```

### boost_histogram.numpy.histogramdd(a: [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[object](https://docs.python.org/3/builtins/functions.html#object), ...], bins: [int](https://docs.python.org/3/builtins/functions.html#int) | [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[int](https://docs.python.org/3/builtins/functions.html#int), ...] | [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)], ...] = 10, range: [Sequence](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence)[[tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[float](https://docs.python.org/3/builtins/functions.html#float), [float](https://docs.python.org/3/builtins/functions.html#float)] | [None](https://docs.python.org/3/builtins/constants.html#None)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, normed: [None](https://docs.python.org/3/builtins/constants.html#None) = None, weights: [object](https://docs.python.org/3/builtins/functions.html#object) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, density: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, , histogram: [type](https://docs.python.org/3/builtins/functions.html#type)[[Histogram](#boost_histogram.histogram.Histogram)[[Any](https://docs.python.org/3/library/typing.html#typing.Any)]] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, storage: [Storage](#boost_histogram.storage.Storage) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, threads: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [Any](https://docs.python.org/3/library/typing.html#typing.Any)

Return a boost-histogram object using the same arguments as numpy’s histogramdd.
This does not support the deprecated normed=True argument. Three extra
arguments are added: histogram=bh.Histogram will enable object based
output, storage=bh.storage.\* lets you set the storage used, and threads=int
lets you set the number of threads to fill with (0 for auto, None for 1).

Compute the multidimensional histogram of some data.

* **Parameters:**
  * **sample** ( *(**N* *,* *D* *)* *array* *, or*  *(**N* *,* *D* *)* *array_like*) – 

    The data to be histogrammed.

    Note the unusual interpretation of sample when an array_like:
    * When an array, each row is a coordinate in a D-dimensional space -
      such as `histogramdd(np.array([p1, p2, p3]))`.
    * When an array_like, each element is the list of values for single
      coordinate - such as `histogramdd((X, Y, Z))`.

    The first form should be preferred.
  * **bins** (*sequence* *or* [*int*](https://docs.python.org/3/builtins/functions.html#int) *,* *optional*) – 

    The bin specification:
    * A sequence of arrays describing the monotonically increasing bin
      edges along each dimension.
    * The number of bins for each dimension (nx, ny, … =bins)
    * The number of bins for all dimensions (nx=ny=…=bins).
  * **range** (*sequence* *,* *optional*) – A sequence of length D, each an optional (lower, upper) tuple giving
    the outer bin edges to be used if the edges are not given explicitly in
    bins.
    An entry of None in the sequence results in the minimum and maximum
    values being used for the corresponding dimension.
    The default, None, is equivalent to passing a tuple of D None values.
  * **density** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool) *,* *optional*) – If False, the default, returns the number of samples in each bin.
    If True, returns the probability *density* function at the bin,
    `bin_count / sample_count / bin_volume`.
  * **weights** ( *(**N* *,* *)* *array_like* *,* *optional*) – An array of values w_i weighing each sample (x_i, y_i, z_i, …).
    Weights are normalized to 1 if density is True. If density is False,
    the values of the returned histogram are equal to the sum of the
    weights belonging to the samples falling into each bin.
* **Returns:**
  * **H** (*ndarray*) – The multidimensional histogram of sample x. See density and weights
    for the different possible semantics.
  * **edges** (*tuple of ndarrays*) – A tuple of D arrays describing the bin edges for each dimension.

#### SEE ALSO
[`histogram`](#boost_histogram.numpy.histogram)
: 1-D histogram

[`histogram2d`](#boost_histogram.numpy.histogram2d)
: 2-D histogram

### Examples

```pycon
>>> import numpy as np
>>> rng = np.random.default_rng()
>>> r = rng.normal(size=(100,3))
>>> H, edges = np.histogramdd(r, bins = (5, 8, 4))
>>> H.shape, edges[0].size, edges[1].size, edges[2].size
((5, 8, 4), 6, 9, 5)
```

# boost_histogram.storage

### *class* boost_histogram.storage.AtomicInt64(\*args: Any, \*\*kwargs: Any)

Bases: `atomic_int64`, [`Storage`](#boost_histogram.storage.Storage)

#### accumulator

alias of [`int`](https://docs.python.org/3/builtins/functions.html#int)

### *class* boost_histogram.storage.Double(\*args: Any, \*\*kwargs: Any)

Bases: `double`, [`Storage`](#boost_histogram.storage.Storage)

#### accumulator

alias of [`float`](https://docs.python.org/3/builtins/functions.html#float)

### *class* boost_histogram.storage.Int64(\*args: Any, \*\*kwargs: Any)

Bases: `int64`, [`Storage`](#boost_histogram.storage.Storage)

#### accumulator

alias of [`int`](https://docs.python.org/3/builtins/functions.html#int)

### *class* boost_histogram.storage.Mean(\*args: Any, \*\*kwargs: Any)

Bases: `mean`, [`Storage`](#boost_histogram.storage.Storage)

### *class* boost_histogram.storage.MultiCell(\*args: Any, \*\*kwargs: Any)

Bases: `multi_cell`, [`Storage`](#boost_histogram.storage.Storage)

#### accumulator

alias of [`float`](https://docs.python.org/3/builtins/functions.html#float)

### *class* boost_histogram.storage.Storage

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

#### accumulator *: ClassVar[[type](https://docs.python.org/3/builtins/functions.html#type)[[int](https://docs.python.org/3/builtins/functions.html#int) | [float](https://docs.python.org/3/builtins/functions.html#float) | accumulators.WeightedMean | accumulators.WeightedSum | accumulators.Mean]]*

### *class* boost_histogram.storage.Unlimited(\*args: Any, \*\*kwargs: Any)

Bases: `unlimited`, [`Storage`](#boost_histogram.storage.Storage)

#### accumulator

alias of [`float`](https://docs.python.org/3/builtins/functions.html#float)

### *class* boost_histogram.storage.Weight(\*args: Any, \*\*kwargs: Any)

Bases: `weight`, [`Storage`](#boost_histogram.storage.Storage)

### *class* boost_histogram.storage.WeightedMean(\*args: Any, \*\*kwargs: Any)

Bases: `weighted_mean`, [`Storage`](#boost_histogram.storage.Storage)

# boost_histogram.tag

### *class* boost_histogram.tag.Locator(offset: [int](https://docs.python.org/3/builtins/functions.html#int) = 0)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

#### NAME *= ''*

#### offset

### boost_histogram.tag.Slicer() → IndexExpression

It is encouraged to use `np.s_` directly instead of this function:

> h[{0: np.s_[::bh.rebin(2)]}]   # rebin axis 0 by two

This is provided for backward compatibility.

### *class* boost_histogram.tag.at(value: [int](https://docs.python.org/3/builtins/functions.html#int))

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

#### value

### *class* boost_histogram.tag.loc(value: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [float](https://docs.python.org/3/builtins/functions.html#float), offset: [int](https://docs.python.org/3/builtins/functions.html#int) = 0)

Bases: [`Locator`](#boost_histogram.tag.Locator)

#### value

### *class* boost_histogram.tag.rebin(factor_or_axis: [int](https://docs.python.org/3/builtins/functions.html#int) | PlottableAxis | [None](https://docs.python.org/3/builtins/constants.html#None) = None, , , factor: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, groups: Sequence[[int](https://docs.python.org/3/builtins/functions.html#int)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, edges: Sequence[[int](https://docs.python.org/3/builtins/functions.html#int) | [float](https://docs.python.org/3/builtins/functions.html#float)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, axis: PlottableAxis | [None](https://docs.python.org/3/builtins/constants.html#None) = None)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

#### axis

#### axis_mapping(axis: PlottableAxis) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[Sequence[[int](https://docs.python.org/3/builtins/functions.html#int)], PlottableAxis | [None](https://docs.python.org/3/builtins/constants.html#None)]

#### edges

#### factor

#### group_mapping(axis: PlottableAxis) → Sequence[[int](https://docs.python.org/3/builtins/functions.html#int)]

Return the list of group sizes (numbers of adjacent bins to merge)
for `axis`. For explicit groups, the sum of the group sizes must
equal the number of bins in the axis. For a factor, this returns
`len(axis) // factor` groups of size `factor`; if the factor does
not divide the number of bins evenly, the leftover bins are not part
of any group (a consumer should merge them into the overflow bin,
matching the C++ factor-based rebinning).

#### groups

### boost_histogram.tag.sum(iterable, , start=0)

Return the sum of a ‘start’ value (default: 0) plus an iterable of numbers

When the iterable is empty, return the start value.
This function is intended specifically for use with numeric values and may
reject non-numeric types.

# boost_histogram.typing

### boost_histogram.typing.ArrayLike

alias of [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)

### *class* boost_histogram.typing.AxisLike(\*args, \*\*kwargs)

Bases: [`Protocol`](https://docs.python.org/3/library/typing.html#typing.Protocol)

#### index(value: [float](https://docs.python.org/3/builtins/functions.html#float) | [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [int](https://docs.python.org/3/builtins/functions.html#int)

### boost_histogram.typing.CppHistogram

alias of [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)

### boost_histogram.typing.Mean

alias of [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)

### *class* boost_histogram.typing.RebinProtocol(\*args, \*\*kwargs)

Bases: [`Protocol`](https://docs.python.org/3/library/typing.html#typing.Protocol)

#### axis_mapping(axis: PlottableAxis) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[Sequence[[int](https://docs.python.org/3/builtins/functions.html#int)], PlottableAxis | [None](https://docs.python.org/3/builtins/constants.html#None)]

### boost_histogram.typing.Ufunc

alias of [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)

### boost_histogram.typing.WeightedMean

alias of [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)

### boost_histogram.typing.WeightedSum

alias of [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)

# boost_histogram.view

### *class* boost_histogram.view.MeanView(shape, dtype=None, buffer=None, offset=0, strides=None, order=None)

Bases: `_MeanArithmetic`, [`View`](#boost_histogram.view.View)

#### *property* count *: [Any](https://docs.python.org/3/library/typing.html#typing.Any)*

#### *property* value *: [Any](https://docs.python.org/3/library/typing.html#typing.Any)*

#### *property* variance *: NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)]*

### *class* boost_histogram.view.View(shape, dtype=None, buffer=None, offset=0, strides=None, order=None)

Bases: [`ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray)[[`Any`](https://docs.python.org/3/library/typing.html#typing.Any), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

### *class* boost_histogram.view.WeightedMeanView(shape, dtype=None, buffer=None, offset=0, strides=None, order=None)

Bases: `_MeanArithmetic`, [`View`](#boost_histogram.view.View)

#### *property* sum_of_weights *: [Any](https://docs.python.org/3/library/typing.html#typing.Any)*

#### *property* sum_of_weights_squared *: [Any](https://docs.python.org/3/library/typing.html#typing.Any)*

#### *property* value *: [Any](https://docs.python.org/3/library/typing.html#typing.Any)*

#### *property* variance *: NDArray[[Any](https://docs.python.org/3/library/typing.html#typing.Any)]*

### *class* boost_histogram.view.WeightedSumView(shape, dtype=None, buffer=None, offset=0, strides=None, order=None)

Bases: [`View`](#boost_histogram.view.View)

#### *property* value *: [Any](https://docs.python.org/3/library/typing.html#typing.Any)*

#### *property* variance *: [Any](https://docs.python.org/3/library/typing.html#typing.Any)*

### boost_histogram.view.fields(\*names: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [Callable](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable)[[[type](https://docs.python.org/3/builtins/functions.html#type)[[object](https://docs.python.org/3/builtins/functions.html#object)]], [type](https://docs.python.org/3/builtins/functions.html#type)[[object](https://docs.python.org/3/builtins/functions.html#object)]]

This decorator adds the name to the \_FIELDS
class property (for printing in reprs), and
adds a property that looks like this:

@property
def name(self):

> return self[“name”]

@name.setter
def name(self, value):

> self[“name”] = value

### boost_histogram.view.make_getitem_property(name: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [property](https://docs.python.org/3/builtins/functions.html#property)
