Install & Compatibility
Where this runs
tested against v0.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
✕ build_error
✓ 90.3s
py 3.11
✕ build_error
✓ 87.3s
py 3.12
✕ build_error
✓ 77s
py 3.13
✕ build_error
✓ 72.3s
py 3.9
✕ build_error
✕ timeout
5248MB installed
● package 5248MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
mcar
✓ from pygrinder import mcar
Earlier versions (pre-0.4) returned masks; now returns only corrupted data.
mar_logistic
✓ from pygrinder import mar_logistic
Renamed from mar_logistic (always existed).
mnar_x
✓ from pygrinder import mnar_x
Renamed from mnar_x (always existed).
mnar_t
✓ from pygrinder import mnar_t
Renamed from mnar_t (always existed).
mnar_nonuniform
✓ from pygrinder import mnar_nonuniform
Added in v0.7, replaces mnar_num.
seq_missing
✓ from pygrinder import seq_missing
Added in v0.6.
block_missing
✓ from pygrinder import block_missing
Added in v0.6.
rdo
✓ from pygrinder import rdo
Added in v0.5.
fill_and_get_mask
✓ from pygrinder import fill_and_get_mask
Added in v0.4.
little_mcar_test
✓ from pygrinder import little_mcar_test
Added in v0.2.
calc_missing_rate
✓ from pygrinder import calc_missing_rate
✗ from pygrinder import calc_misssing_rate
Typo in v0.6.1 used 'calc_misssing_rate' (extra 's'), corrected to 'calc_missing_rate' from v0.6.2 onwards.
Basic usage: create MCAR missingness, then fill NaNs and get mask.
import numpy as np
from pygrinder import mcar, fill_and_get_mask
X = np.random.randn(100, 10)
corrupted_X = mcar(X, rate=0.2)
X_filled, mask = fill_and_get_mask(corrupted_X, fill_value=0)
print(f"Original shape: {X.shape}, missing rate: {1 - mask.mean():.2f}")
Errors
Common errors & fixes
AttributeError: module 'pygrinder' has no attribute 'calc_misssing_rate'
Typo in function name; the correct name is calc_missing_rate (single 's' after 'miss').
fixUse from pygrinder import calc_missing_rate
TypeError: mcar() got multiple values for argument 'rate'
Passing both positional and keyword argument for 'rate', or duplicate keyword.
fixCall mcar(X, rate=0.2) with only one rate specification.
ValueError: seq_len must be less than n_steps
In seq_missing, seq_len equals or exceeds the number of time steps, causing an empty index list.
fixSet seq_len < n_steps, or upgrade to pygrinder >=0.6.4 where this condition is handled.
Upgrade
Version history
0.7latest on PyPI · released Feb 3, 2025
Audit
Dependencies
numpyrequiredCore dependency for array operations
torchrequiredUsed for random number generation and tensor operations