speedystats
speedystats is a Python package designed to accelerate NumPy statistical operations using Numba. The package maintains a clean API that mirrors NumPy's interface while providing significant performance improvements through parallel processing.
"Is it possible to use numba to speed up my median computation?"
Yep. Just use speedystats.
"Is it possible to use numba to make np.std go faster?
Yep. Just use speedystats.
Features
- Drop-in replacement for common NumPy statistical functions
- Significant performance improvements through Numba optimization
- Maintains NumPy-like API for easy integration
Installation
pip install speedystats
Quick Start
import numpy as np
import speedystats as fs
# Create some test data
data = np.random.randn(1000, 1000)
# Use just like numpy
mean = fs.mean(data, axis=0)
std = fs.std(data, axis=1)
median = fs.median(data)
# Works with nan values too
data_with_nans = data.copy()
data_with_nans[0, 0] = np.nan
nanmean = fs.nanmean(data_with_nans, axis=0)
Available Functions
- Basic Statistics:
mean,median,std,var,sum - Range Statistics:
ptp(peak-to-peak) - Percentile Functions:
percentile,quantile - NaN-aware Variants:
nanmean,nanmedian,nanstd,nanvar,nansum - Additional Functions:
average,zscore
Performance Note
While speedystats is designed for performance, the actual speedup depends on your specific use case, data size, and hardware. The package is most effective with:
- Large arrays (typically > 100,000 elements)
- Multi-core processors (for parallel execution)
- Certain methods are sped up much more than numpy
- Certain axis / dimension combinations get huge speedups, others are usually comparable to numpy
Note: Benchmarking tools for automatic routing to speedystats implementation vs numpy default methods isn't finished --- so you are responsible for determining whether speedystats is faster. Here's an example of how to test it quickly:
from time import time import numpy as mp import speedystats as fs # Suppose you want to test if median is faster for arrays of a certain shape and size array = np.random.randn(1000, 10000) axis = 1 # Set repeats to get a better estimate num_repeats = 20 # numba functions always have to be compiled, which takes a moment, # but speedystats caches them so you only have to wait once (it's just a second or so) # so it's good to use a "warmup": # you'll need to warmup each combination of number dimensions (2 here) and axis _ = fs.median(np.zeros((10, 10)), axis=axis) t = time() for _ in range(num_repeats): _ = np.median(array, axis=axis) numpy_time = time() - t t = time() for _ in range(num_repeats): _ = fs.median(array, axis=axis) speedystat_time = time() - t print("Speedup: ", numpy_time / speedystat_time)Comprehensive benchmarking tools are under development. When they're released, this will be automated.
Development Status
This package is in beta. While the core functionality is stable, we're actively working on:
- Comprehensive benchmarking suite
- Performance optimization guides
- Additional statistical functions
- Advanced documentation
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the GNU General Public License v3 (GPLv3) - see the LICENSE file for details.
Metadata
Release files for speedystats 0.1.1
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 | |
|---|---|---|---|---|
| speedystats-0.1.1.tar.gz | 41.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| speedystats-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 91.7 kB
Release files / speedystats-0.1.1.tar.gz
| Download URL | speedystats-0.1.1.tar.gz |
|---|---|
| Size | 41.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23daf5b8a676422c1f37f6e61263cfa937c5add6bac54204cd017d8164db46af
|
|
BLAKE2b-256 checksum How to use checksums |
ecbb07f4e410a5adc8d39e9e2493deec2d8ef8b149bb91d3d063665c0fb6d6ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / speedystats-0.1.1-py3-none-any.whl
| Download URL | speedystats-0.1.1-py3-none-any.whl |
|---|---|
| Size | 50.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db053bd0502cedca2df5c8152a188212ec9c8928bda0bb5dbfdbceded76cff04
|
|
BLAKE2b-256 checksum How to use checksums |
1c09bdf11c3f89a67aba4ecba0f63f468122cc62ccfbe487b9139da4fa8b4ff9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for speedystats 0.1.1
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.