# simplebins
**simplebins** is a lightweight Python utility that makes it easy to bin numeric values into equal-width intervals.
It supports individual numbers, lists and `pandas.Series`.
## Features
- Works with numbers, lists and `pandas.Series`
- Returns either the bin index, floor, ceiling, midpoint, or a human-readable label
- Clean and intuitive API
- Handles missing values gracefully
- Zero dependencies outside of `pandas` and `numpy`
## Why not `pandas.cut()`?
`pandas.cut()` is powerful but sometimes overkill.
**simplebins** simplifies the common use case: fixed-width bins with predictable, numeric output – perfect for quick transformations.
## Installation
```bash
pip install simplebins
```
## Usage
```python
from simplebins import cut
```
### Bin a single number
```python
cut(12, binwidth=5)
# Output: 10
```
### Bin a list of numbers
```python
cut([3, 7, 12], binwidth=5)
# Output: [0, 5, 10]
```
### Bin a pandas Series
```python
import pandas as pd
import numpy as np
cut(pd.Series([3, 7, np.nan]), binwidth=5)
# Output:
# 0 0
# 1 5
# 2 nan
# dtype: object
```
Raw data
{
"_id": null,
"home_page": null,
"name": "simplebins",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "binning, discretization, data-preprocessing, pandas, utilities",
"author": "Marius Kaffai",
"author_email": "marius.kaffai.sowi@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/78/7b/e30145406208ee50d2a2971f40c738312ee9463dfda29ae5a0af19a4c5cb/simplebins-0.3.0.tar.gz",
"platform": null,
"description": "# simplebins\n\n**simplebins** is a lightweight Python utility that makes it easy to bin numeric values into equal-width intervals. \nIt supports individual numbers, lists and `pandas.Series`.\n\n\n## Features\n\n- Works with numbers, lists and `pandas.Series` \n- Returns either the bin index, floor, ceiling, midpoint, or a human-readable label \n- Clean and intuitive API \n- Handles missing values gracefully \n- Zero dependencies outside of `pandas` and `numpy`\n\n\n## Why not `pandas.cut()`?\n\n`pandas.cut()` is powerful but sometimes overkill. \n**simplebins** simplifies the common use case: fixed-width bins with predictable, numeric output \u2013 perfect for quick transformations.\n\n\n## Installation\n\n```bash\npip install simplebins\n```\n\n\n## Usage\n\n```python\nfrom simplebins import cut\n```\n\n### Bin a single number\n```python\ncut(12, binwidth=5)\n# Output: 10\n```\n\n### Bin a list of numbers\n```python\ncut([3, 7, 12], binwidth=5)\n# Output: [0, 5, 10]\n```\n\n### Bin a pandas Series\n```python\nimport pandas as pd\nimport numpy as np\ncut(pd.Series([3, 7, np.nan]), binwidth=5)\n# Output: \n# 0 0\n# 1 5\n# 2 nan\n# dtype: object\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A lightweight Python package to discretize numeric values into bins, similar to pandas.cut(), but simpler and more intuitive.",
"version": "0.3.0",
"project_urls": {
"Homepage": "https://github.com/mariuzka/simplebins",
"Repository": "https://github.com/mariuzka/simplebins"
},
"split_keywords": [
"binning",
" discretization",
" data-preprocessing",
" pandas",
" utilities"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8feb75150814a28c87650083825217bda9ce4fb9abaaa8caf08df5150d6aa503",
"md5": "5300d80ccdf203947f16709447d02cfd",
"sha256": "e0372d333036eca0e79c984066296ba49b7f094183cb971018fde0e721d09c9a"
},
"downloads": -1,
"filename": "simplebins-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5300d80ccdf203947f16709447d02cfd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 3173,
"upload_time": "2025-10-08T14:17:35",
"upload_time_iso_8601": "2025-10-08T14:17:35.903857Z",
"url": "https://files.pythonhosted.org/packages/8f/eb/75150814a28c87650083825217bda9ce4fb9abaaa8caf08df5150d6aa503/simplebins-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "787be30145406208ee50d2a2971f40c738312ee9463dfda29ae5a0af19a4c5cb",
"md5": "177afa42318e25200f55d3e24fe282be",
"sha256": "a2e4cac84d9c659fd4fccc0b7a5184cdcbe31919881e350465793c60d621d46f"
},
"downloads": -1,
"filename": "simplebins-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "177afa42318e25200f55d3e24fe282be",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 2603,
"upload_time": "2025-10-08T14:17:37",
"upload_time_iso_8601": "2025-10-08T14:17:37.346421Z",
"url": "https://files.pythonhosted.org/packages/78/7b/e30145406208ee50d2a2971f40c738312ee9463dfda29ae5a0af19a4c5cb/simplebins-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-08 14:17:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mariuzka",
"github_project": "simplebins",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "simplebins"
}