All nine Hyndman-Fan sample-quantile estimators plus pandas helpers & plots.
Project description
C2Percentiles
A lightweight, zero-dependency (core) Python package that delivers all nine Hyndman-Fan sample-quantile estimators—plus ready-made helpers for multi-column, group-wise, and visual work-flows.
PyPI pip install C2Percentiles
License MIT
Python ≥ 3.8
Why this package?
Standard libraries (NumPy, pandas) give you only one estimator—Type 7.
Research or regulatory work often needs Type 8 (median-unbiased) or Type 9 (normal QQ-plots).
C2Percentiles gives you all nine in a single line, plus batteries-included helpers for:
- single vectors
- many columns at once
- stratification by groups
- quick Seaborn/ Matplotlib visuals
Installation
# core only – no plotting
pip install C2Percentiles
# with plotting extras
pip install "C2Percentiles[plots]"
60-second tutorial
import numpy as np, pandas as pd, quantile_kit as qk
# any 1-D data
x = np.random.randn(100)
# all nine 0.25, 0.50, 0.75 quantiles
qk.quantile_custom(x, [0.25, 0.5, 0.75], qtype="all")
# → DataFrame indexed by probability
# only Types 7 & 8, 4 sig-digits, pretty strings
qk.quantile_custom(x, [0.1, 0.9], qtype=[7, 8], sig_digits=4)
# many columns at once
df = pd.DataFrame({"A": np.random.randn(80),
"B": np.random.randn(80)*50 + 100,
"Group": np.random.choice(["G1", "G2"], 80)})
qk.quantiles_for_vars(df, ["A", "B"], probs=[0.05, 0.5, 0.95])
# → long table: Variable | Probability | Type1 … Type9
# group-wise
qk.quantiles_by_group(df, "Group", ["A", "B"], probs=[0.25, 0.75])
# quick plot – estimator spread
qk.plot_quantile_line(df["B"], probs=[0.05, 0.5, 0.95])
API reference
| Signature | Description |
|---|---|
quantile_custom(x, probs, qtype=7, sig_digits=None) |
core engine |
quantiles_for_vars(df, vars, probs, qtype, sig_digits) |
multi-column |
quantiles_by_group(df, group_var, num_vars, probs, qtype, sig_digits) |
grouped |
plot_quantile_line(x, probs, …) |
single-variable plot |
plot_qfv(df, vars, probs, …) |
faceted by variable |
plot_qbg(df, group_var, vars, probs, …) |
faceted by group & variable |
Full doc-strings are available via help(...) or your IDE.
Citation
If you use this package in research, please cite:
Hyndman, R. J. and Fan, Y. (1996) “Sample Quantiles in Statistical Packages”, American Statistician 50(4): 361–365.
License
MIT – see LICENSE file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file c2percentiles-0.1.1.tar.gz.
File metadata
- Download URL: c2percentiles-0.1.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0226043a204b66fd9b16c6316355efb68958143a245dc899ad7c8d974ecde291
|
|
| MD5 |
b97f7c5ab03ce74329e35080c534163b
|
|
| BLAKE2b-256 |
439cda60c5cbc81f71b7339b8731298127b3ca5ee70b5c5c939b336f7e9f5327
|
File details
Details for the file c2percentiles-0.1.1-py3-none-any.whl.
File metadata
- Download URL: c2percentiles-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29ba4b5e19aadfe0d08b2558720d5307fd75cc674dd2c94087639d34beb68542
|
|
| MD5 |
7dd4cf93502326f1dc1ee04a00bfb488
|
|
| BLAKE2b-256 |
e979dbd7405b340e2c505ddf08877d33e2017f61bd5d7e2e5131a54b7800e764
|