Metadata-Version: 2.1
Name: compressbins
Version: 1.1.0
Summary: Convert numpy bins of the form [0,2,4,6,8,10] to a string format ideal for frequency chart tables ['0-2','2-4','4-6','6-8','8-10']
Author-email: Jack Trudan <jackt149@gmail.com>
License: Copyright 2024 Jack Trudan
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project-URL: Homepage, https://github.com/jtrudan/compressbins
Keywords: histograms,stats
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: bumpver; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: pip-tools; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: numpy; extra == "dev"

### compress-bins

This package provides the compress_bins() function, a quality-of-life function for creating frequency charts in the numpy-pandas ecosystem.

Usage:
```
import compressbins.compressbins as cb

compressed_bins = cb.compress_bins([0,2,4,6])
print(compressed_bins) # ['0-2','2-4','4-6']
```

We can then use these sbins in creating frequency charts:
```
import pandas as pd
import numpy as np

counts, bins = np.histogram(df, bins=np.arange(10.00, 20.00, 1.00))
cbins = compress_bins(bins)
freqChart = pd.DataFrame({"Cost":cbins, "Count":counts})
print(freqChart)
        Cost  Count
0  10.0-11.0      1
1  11.0-12.0      8
2  12.0-13.0     16
3  13.0-14.0      9
4  14.0-15.0      6
5  15.0-16.0      4
6  16.0-17.0      3
7  17.0-18.0      2
8  18.0-19.0      1
```

