Skip to content

Commit

Permalink
allow weights to be single numbers like values
Browse files Browse the repository at this point in the history
  • Loading branch information
lgray committed Dec 24, 2020
1 parent c1d28d2 commit c3789b0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions coffea/hist/hist_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,8 @@ def fill(self, **values):
weight = values.pop("weight", None)
if isinstance(weight, (awkward1.Array, np.ndarray)):
weight = coffea.util._ensure_flat(weight)
if isinstance(weight, numbers.Number):
weight = np.atleast_1d(weight)
if not all(d.name in values for d in self._axes):
missing = ", ".join(d.name for d in self._axes if d.name not in values)
raise ValueError("Not all axes specified for %r. Missing: %s" % (self, missing))
Expand Down

0 comments on commit c3789b0

Please sign in to comment.