skrub-data/skrub
Machine learning with dataframes
skrub – Data‑frame‑friendly preprocessing for machine learning
What it is
- A Python library that provides utilities to clean, transform, and encode tabular data stored in pandas‑like dataframes so that they can be fed directly to scikit‑learn (or any other ML) models.
- It focuses on the pre‑processing stage rather than model training or inference.
Key capabilities (as described in the README)
| Capability | What it does |
|---|---|
| Column‑wise cleaning | Detects and fixes common issues such as inconsistent string formatting, missing values, and out‑of‑vocabulary categories. |
| Encoding | Offers robust encoders (e.g., target encoding, frequency encoding) that work with high‑cardinality categorical columns without exploding the feature space. |
| Similarity‑based grouping | Groups similar strings (e.g., misspelled product names) automatically, reducing noise before modeling. |
| Integration with scikit‑learn | Provides transformer classes that follow the scikit‑learn fit/transform API, so they can be dropped into pipelines. |
| Documentation & examples | Comes with a website, auto‑generated docs, and a collection of runnable examples that illustrate typical workflows. |
| Community | Has a Discord server and a GitHub Discussions page for user support and sharing use‑cases. |
Typical workflow
import pandas as pd
import skrub
# Load a dataframe
df = pd.read_csv('data.csv')
# Clean and encode with a scikit‑learn pipeline
from sklearn.pipeline import make_pipeline
from sklearn.ensemble import RandomForestClassifier
pipeline = make_pipeline(
skrub.Cleaner(), # fixes strings, missing values, etc.
skrub.TargetEncoder(), # turns categoricals into numeric features
RandomForestClassifier()
)
pipeline.fit(df.drop('target', axis=1), df['target'])
The library handles the messy, real‑world data preparation steps that are often the bottleneck in ML projects.
Installation
- Available on PyPI and conda‑forge:
pip install skruborconda install -c conda-forge skrub. - The README points to detailed install instructions on the project website.
Getting started & learning resources
- The official site (
https://skrub-data.org/) hosts auto‑generated documentation, a gallery of examples, and a set of learning materials. - After installing, you can locate the bundled docs with:
import skrub print(skrub.__docs_dir__)
Community & contribution
- Users are encouraged to spread the word, join the Discord, and discuss use‑cases on GitHub Discussions.
- Bugs and feature requests are handled via GitHub issues; contribution guidelines are provided on the website.
Citation
- For academic work, cite the Zenodo archive linked in the README.
Bottom line skrub is a practical, well‑documented toolbox that bridges the gap between raw tabular data and clean, model‑ready features, making it especially useful for data scientists who spend most of their time wrangling messy dataframe inputs before training machine‑learning models.
Related
- Project
- Project
- Project
- Project
- Project