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

Correcting the implementation of the ascii() method. #23

Closed jpivarski closed 7 years ago

jpivarski commented 7 years ago

I was too hasty in accepting the Bin.ascii pull request. The old implementation

This new version fixes those and improves formatting for floating point. Example with floating point entries:

                   0.0                                                    91.8002740623
                      +--------------------------------------------------------------+
underflow      0      |                                                              |
[-90.0, -80.0) 0      |                                                              |
[-80.0, -70.0) 0      |                                                              |
[-70.0, -60.0) 0      |                                                              |
[-60.0, -50.0) 0.7124 |                                                              |
[-50.0, -40.0) 2.596  |**                                                            |
[-40.0, -30.0) 5.61   |****                                                          |
[-30.0, -20.0) 24.18  |****************                                              |
[-20.0, -10.0) 38.64  |**************************                                    |
[-10.0, 0.0)   79.63  |******************************************************        |
[0.0, 10.0)    91.8   |**************************************************************|
[10.0, 20.0)   89.96  |************************************************************* |
[20.0, 30.0)   78.63  |*****************************************************         |
[30.0, 40.0)   53.53  |************************************                          |
[40.0, 50.0)   20.47  |**************                                                |
[50.0, 60.0)   8.473  |******                                                        |
[60.0, 70.0)   3.773  |***                                                           |
[70.0, 80.0)   0.7507 |*                                                             |
overflow       0.8724 |*                                                             |
nanflow        0      |                                                              |
                      +--------------------------------------------------------------+

Example with integer entries:

                 0.0                                                           2194.0
                    +--------------------------------------------------------------+
underflow      0    |                                                              |
[-90.0, -80.0) 0    |                                                              |
[-80.0, -70.0) 0    |                                                              |
[-70.0, -60.0) 2    |                                                              |
[-60.0, -50.0) 12   |                                                              |
[-50.0, -40.0) 41   |*                                                             |
[-40.0, -30.0) 186  |*****                                                         |
[-30.0, -20.0) 476  |*************                                                 |
[-20.0, -10.0) 969  |***************************                                   |
[-10.0, 0.0)   1610 |*********************************************                 |
[0.0, 10.0)    2194 |**************************************************************|
[10.0, 20.0)   2070 |**********************************************************    |
[20.0, 30.0)   1670 |***********************************************               |
[30.0, 40.0)   1029 |*****************************                                 |
[40.0, 50.0)   486  |**************                                                |
[50.0, 60.0)   176  |*****                                                         |
[60.0, 70.0)   67   |**                                                            |
[70.0, 80.0)   10   |                                                              |
overflow       1    |                                                              |
nanflow        0    |                                                              |
                    +--------------------------------------------------------------+
ab-10 commented 7 years ago

Oh, I see. Thank you for fixing it.