Skip to content

Commit 43f69c9

Browse files
committed
fix of get_sub_hist() when Bin histogram is filled only with nans
- fix of util._get_sub_hist()
1 parent 3b09f31 commit 43f69c9

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

CHANGES.rst

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
Release notes
33
=============
44

5+
Version 1.0.33, Sep 2022
6+
------------------------
7+
* fix of get_sub_hist() when Bin histogram is filled only with nans.
8+
59
Version 1.0.32, Sep 2022
610
------------------------
711
* Support for decimal datetype in pandas and spark.

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ PyCUDA is available, they can also be filled from Numpy arrays by JIT-compiling
2020

2121
This Python implementation of histogrammar been tested to guarantee compatibility with its Scala implementation.
2222

23-
Latest Python release: v1.0.32 (Sep 2022).
23+
Latest Python release: v1.0.33 (Dec 2022).
2424

2525

2626
Announcements

histogrammar/util.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -628,12 +628,17 @@ def _get_sub_hist(hist):
628628
if isinstance(hist, histogrammar.Categorize):
629629
sub_hist = hist.values[0] if hist.values else hist.value
630630
elif isinstance(hist, histogrammar.Bin):
631-
if hist.entries > 0:
631+
if hist.entries > 0 and len(hist.values) > 0:
632632
# pick first sub-hist found that is filled
633-
idx = next(i for i, b in enumerate(hist.values) if b.entries > 0)
633+
# note: could still be that all bins are unfilled. if so pick first bin.
634+
idx = 0
635+
for i, b in enumerate(hist.values):
636+
if b.entries > 0:
637+
idx = i
638+
break
634639
sub_hist = hist.values[idx]
635640
else:
636-
sub_hist = hist.values[0] if hist.values else histogrammar.Count()
641+
sub_hist = hist.values[0] if len(hist.values) > 0 else histogrammar.Count()
637642
elif isinstance(hist, (histogrammar.SparselyBin, histogrammar.CentrallyBin)):
638643
sub_hist = list(dict(hist.bins).values())[0] if hist.bins else hist.value
639644
elif isinstance(hist, (histogrammar.IrregularlyBin, histogrammar.Stack)):

histogrammar/version.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import re
44

55
name = "histogrammar"
6-
__version__ = "1.0.32"
7-
version = "1.0.32"
8-
full_version = "1.0.32"
6+
__version__ = "1.0.33"
7+
version = "1.0.33"
8+
full_version = "1.0.33"
99
release = True
1010

1111
version_info = tuple(re.split(r"[-\.]", __version__))

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
MAJOR = 1
2424
REVISION = 0
25-
PATCH = 32
25+
PATCH = 33
2626
DEV = False
2727
# NOTE: also update version at: README.rst and update CHANGES.rst
2828

0 commit comments

Comments
 (0)