balanced-splits
A utility library for splitting datasets in a balanced manner, with regards to several features.
Installation
pip install balanced-splits
Usage
import numpy as np
import pandas as pd
from balanced_splits.split import optimized_split
sample_size = 100
df = pd.DataFrame({
'age': np.random.normal(loc=45, scale=7., size=sample_size),
'skill': 1 - np.random.power(4, size=sample_size),
'type': np.random.choice(['T1', 'T2', 'T3'], size=sample_size)
})
A, B = optimized_split(df)
print('Partition 1\n===========\n')
print(A.describe())
print(A['type'].value_counts())
print('\n\n')
print('Partition 2\n===========\n')
print(B.describe())
print(B['type'].value_counts())
Check out the "examples" section for more examples.
Metadata
Release files for balanced-splits 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| balanced-splits-0.2.0.tar.gz | 4.4 kB | Without provenance | Details for balanced-splits-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| balanced_splits-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for balanced_splits-0.2.0-py3-none-any.whl |
Total release size: 10.7 kB
Release files / balanced-splits-0.2.0.tar.gz
| Download URL | balanced-splits-0.2.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dee302aa2f6d4b4c01617dbf1ff2c5141f298122a5bbc26ed457c45d455984c4
|
|
BLAKE2b-256 checksum How to use checksums |
d12ce6a2dce1d7670d62c7f5242b20e339c9b0089deb726c151837962d0c73fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
|
Release files / balanced_splits-0.2.0-py3-none-any.whl
| Download URL | balanced_splits-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0b098e9c2b0e7e984aec304b61aa57a8b7de25b594b636fa5ea572a9ea0010f6
|
|
BLAKE2b-256 checksum How to use checksums |
aef0e93330681b328a1c62d54d108ad6f83c0d335df6641c9ca1d0aa1c4fb0d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
|
Security for balanced-splits 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.