pygrinder
A Python toolkit for introducing missing values into datasets
What it is and what it does
PyGrinder is a data corruption toolkit designed to inject missing values into datasets using multiple well-defined patterns. It was originally part of PyPOTS (a time-series data mining framework) and separated to decouple missingness generation from learning algorithms. The package supports MCAR (Missing Completely At Random), MAR (Missing At Random), MNAR (Missing Not At Random with variants), RDO (Random Data Observation), and structured patterns like sequential and block missing values.
The typical use case is preparing synthetic incomplete datasets for evaluating how machine learning models handle partial observations or for testing data reconstruction algorithms. You pass a numpy array (often time-series data with shape like samples × timesteps × features) and a pattern function with parameters controlling the missing rate or structure, and receive back a dataset with missing values injected. The package also provides a utility to calculate the resulting missing rate.
Use it for:
- Evaluate time-series imputation models by creating datasets with known missingness patterns to test reconstruction accuracy.
- Generate partially-observed datasets for training robust models that must handle incomplete real-world observations.
- Benchmark data mining algorithms on incomplete data without needing to manually corrupt or collect partial datasets.
- Simulate different missing-data mechanisms (MCAR vs. MNAR) to study how model performance varies with missingness type.
- Create test suites for data preprocessing pipelines that must handle missing values in production.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyGrinder introduces missing values into datasets using multiple patterns (MCAR, MAR, MNAR, RDO, sequential, block) to simulate incomplete data for model evaluation and testing.
Yes. PyGrinder is actively maintained, has no known vulnerabilities, uses a permissive license, and solves a specific and common problem in machine learning: creating incomplete datasets for model evaluation. The low install friction and production-stable status make it a straightforward choice if you need to simulate missing data patterns. Install it if you work with time-series data or incomplete observations in model development or research.
Install
pygrinder on PyPI
pip
pip install pygrinderuv
uv add pygrinderpoetry
poetry add pygrinderInstalling pygrinder
Before you install
Low friction installation via wheel; active maintenance with recent commits and production-stable status. Runtime dependencies on numpy, scikit-learn, pandas, torch, and tsdb are standard data science libraries.
License in practice
BSD license (permissive); allows commercial and private use with attribution and liability disclaimers. No restrictions on modification or redistribution.
Quickstart
pip install pygrinder
import numpy as np
from pygrinder import mcar, calc_missing_rate
ts_dataset = np.random.randn(128, 10, 36)
X_with_mcar = mcar(ts_dataset, p=0.1)
missing_rate = calc_missing_rate(X_with_mcar)
Requires Python >=3.8; torch dependency may require separate installation depending on your system.
Verify before relying
- Whether all five runtime dependencies (torch, tsdb, etc.) are always required or only for specific patterns.
- Performance characteristics when working with very large time-series datasets.
- Whether the package supports GPU acceleration through torch.
Package facts
| License | Copyright (c) 2023-present, Wenjie Du All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — numpy, scikit-learn, pandas, torch, tsdb |
| Maintenance | actively maintained — 557 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 122,792/month — #11,933 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pygrinder-0.7-py3-none-any.whl
Keywords: data corruption, incomplete data, data mining, pypots, missingness, partially observed, irregular sampled, partially-observed time series, incomplete time series, missing data, missing values, simulation, pypots
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
benchpotsBenchPOTS provides standardized preprocessing…
permissive · top 15,000 on PyPI
stumpySTUMPY computes the matrix profile for time…
permissive · top 15,000 on PyPI
pypotsPyPOTS provides machine learning algorithms for…
permissive · top 15,000 on PyPI
ai4tsAI4TS provides a framework for building machine…
permissive · top 15,000 on PyPI
tsdbTSDB downloads and loads 173 open-source…
permissive · top 15,000 on PyPI
pytorch-forecastingPyTorch Forecasting provides neural network…
permissive · top 15,000 on PyPI
datasetsforecastDownloads and loads curated time-series…
permissive · top 15,000 on PyPI
dartsDarts provides forecasting and anomaly…
permissive · top 15,000 on PyPI
nutpienutpie provides a fast NUTS sampler for…
permissive · top 15,000 on PyPI