Name | compressbins JSON |
Version |
1.2.0
JSON |
| download |
home_page | None |
Summary | Convert numpy bins to a string format ideal for creating frequency charts in the numpy-pandas ecosystem. Ex. [0, 2, 4, 6, 8, 10] -> ['0-2', '2-4', '4-6', '6-8', '8-10'] |
upload_time | 2024-09-02 02:58:51 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
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. |
keywords |
histograms
stats
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
### 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 compressed bins 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
```
Raw data
{
"_id": null,
"home_page": null,
"name": "compressbins",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "histograms, stats",
"author": null,
"author_email": "Jack Trudan <jackt149@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/f6/30/e218fa2f1d842c3789237c0533b8d6dee5a4200bac558f7189eab5052635/compressbins-1.2.0.tar.gz",
"platform": null,
"description": "### compress-bins\r\n\r\nThis package provides the compress_bins() function, a quality-of-life function for creating frequency charts in the numpy-pandas ecosystem.\r\n\r\nUsage:\r\n```\r\nimport compressbins.compressbins as cb\r\n\r\ncompressed_bins = cb.compress_bins([0,2,4,6])\r\nprint(compressed_bins) # ['0-2','2-4','4-6']\r\n```\r\n\r\nWe can then use these compressed bins in creating frequency charts:\r\n```\r\nimport pandas as pd\r\nimport numpy as np\r\n\r\ncounts, bins = np.histogram(df, bins=np.arange(10.00, 20.00, 1.00))\r\ncbins = compress_bins(bins)\r\n\r\nfreqChart = pd.DataFrame({\"Cost\":cbins, \"Count\":counts})\r\nprint(freqChart)\r\n\r\n Cost Count\r\n0 10.0-11.0 1\r\n1 11.0-12.0 8\r\n2 12.0-13.0 16\r\n3 13.0-14.0 9\r\n4 14.0-15.0 6\r\n5 15.0-16.0 4\r\n6 16.0-17.0 3\r\n7 17.0-18.0 2\r\n8 18.0-19.0 1\r\n```\r\n\r\n",
"bugtrack_url": null,
"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 \u201cSoftware\u201d), 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 \u201cAS IS\u201d, 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.",
"summary": "Convert numpy bins to a string format ideal for creating frequency charts in the numpy-pandas ecosystem. Ex. [0, 2, 4, 6, 8, 10] -> ['0-2', '2-4', '4-6', '6-8', '8-10']",
"version": "1.2.0",
"project_urls": {
"Homepage": "https://github.com/jtrudan/compressbins"
},
"split_keywords": [
"histograms",
" stats"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ebfc220569be259319aeeae3a1489a887b246a0303c0cead79a84553af450327",
"md5": "ba612f73a2431c461ebc2afb4262c875",
"sha256": "fa15a290af00ffae1a08c9c27b1349f01fbfce34d7e8d6983acd937c7a89b10f"
},
"downloads": -1,
"filename": "compressbins-1.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ba612f73a2431c461ebc2afb4262c875",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 3987,
"upload_time": "2024-09-02T02:58:49",
"upload_time_iso_8601": "2024-09-02T02:58:49.919122Z",
"url": "https://files.pythonhosted.org/packages/eb/fc/220569be259319aeeae3a1489a887b246a0303c0cead79a84553af450327/compressbins-1.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f630e218fa2f1d842c3789237c0533b8d6dee5a4200bac558f7189eab5052635",
"md5": "cbc7deb290963a70b07dfe5b5d692e3a",
"sha256": "ed8a12fc97dc0614bc359a2b1c6df42e078432ea916ba906f19a0a8e1fe9ffa0"
},
"downloads": -1,
"filename": "compressbins-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "cbc7deb290963a70b07dfe5b5d692e3a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 3733,
"upload_time": "2024-09-02T02:58:51",
"upload_time_iso_8601": "2024-09-02T02:58:51.199341Z",
"url": "https://files.pythonhosted.org/packages/f6/30/e218fa2f1d842c3789237c0533b8d6dee5a4200bac558f7189eab5052635/compressbins-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-02 02:58:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jtrudan",
"github_project": "compressbins",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "compressbins"
}