histogrammar / histogrammar-python

Python implementation of Histogrammar, a package for creating histograms with Numpy, Pandas and Spark.
https://histogrammar.github.io/histogrammar-docs/
Apache License 2.0
33 stars 11 forks source link

In sparselybin switch q array to floats before applying divide and floor #21

Closed mbaak closed 7 years ago

mbaak commented 7 years ago

One more request I'm afraid, I hope it's the last one. Could you turn this into tag 1.0.8 as well? Many thanks!

In sparselybin I switched the q array to floats before applying divide and floor. (In fact I see that the same is done for normally binned histograms.) If not, for some reason numpy throws TypeError on trivial integer array cases such as:

q = numpy.array([1,2,3,4]) np.divide(q,1,q) np.floor(q,q)

which can easily happen if your default binwidth is 1.

In fact, unless specified this is my default binning. So any sparse histograms filled with integers fail for me.