sklearndf
Data frame support and feature traceability for `scikit-learn`.
What it is and what it does
sklearndf is a wrapper library that enhances scikit-learn estimators to preserve pandas DataFrames and feature names through transformations. When you use scikit-learn's transformers, they typically return numpy arrays even if your input was a DataFrame, losing column names in the process. This makes it hard to trace which features went where, especially in complex pipelines with feature engineering steps. sklearndf solves this by providing drop-in replacements (e.g., StandardScalerDF instead of StandardScaler) that return DataFrames with feature names intact.
The library depends on numpy, pandas, scipy, scikit-learn, packaging, and gamma-pytools. It supports Python 3.9 through 3.13 and is marked Production/Stable. The main value is in model inspection and debugging: you can see exactly which original features contributed to each output feature, which is crucial when transformers create new features (like one-hot encoding) or when you need to audit a pipeline's behavior.
Use it for:
- Inspect and debug scikit-learn pipelines by keeping track of feature names through all transformation steps.
- One-hot encode categorical features while maintaining a clear mapping from encoded columns back to original features.
- Audit feature engineering in production models to understand which raw inputs drive each final feature.
- Build interpretable machine learning workflows where feature lineage is essential for model validation.
- Integrate scikit-learn into data analysis notebooks where preserving DataFrame structure simplifies downstream exploration.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Wraps scikit-learn estimators to return pandas DataFrames instead of numpy arrays, preserving feature names through transformations and enabling feature traceability across pipelines.
Yes, if you work regularly with scikit-learn pipelines and need to preserve feature names and traceability. The library is stable, has low install friction, and solves a genuine pain point in scikit-learn workflows. Maintenance is aging (last release 345 days ago), so verify compatibility with your scikit-learn version before adopting in new projects. No known security vulnerabilities.
Install
sklearndf on PyPI
pip
pip install sklearndfuv
uv add sklearndfpoetry
poetry add sklearndfInstalling sklearndf
Before you install
Low install friction with a pure-Python wheel. Maintenance is aging—last release was 345 days ago—but the repository remains active and marked Production/Stable. Depends on well-established libraries: numpy, pandas, scipy, scikit-learn, packaging, and gamma-pytools.
License in practice
Licensed under Apache Software License v2.0 (permissive). You may use, modify, and distribute freely in commercial and private projects, provided you include a copy of the license and state significant changes.
Quickstart
pip install sklearndf
from sklearndf.preprocessing import StandardScalerDF
import pandas as pd
X = pd.DataFrame({'a': [2, 3], 'b': [4, 5]})
scaler = StandardScalerDF()
X_scaled = scaler.fit_transform(X) # Returns DataFrame with feature names preserved
Requires Python >=3.9 and <4a; scikit-learn, pandas, scipy, numpy, and packaging must be installed.
Verify before relying
- Whether feature tracing works correctly across all scikit-learn transformer types and custom pipelines.
- Performance overhead of DataFrame wrapping compared to native scikit-learn arrays.
- Compatibility with recent scikit-learn versions beyond those explicitly tested.
Package facts
| License | Apache Software License v2.0 (permissive) |
| Python support | supports the current Python release (<4a,>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — gamma-pytools, numpy, packaging, pandas, scikit-learn, scipy |
| Maintenance | aging — 345 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 85,647/month — #13,910 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sklearndf-2.4.2-py3-none-any.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
sklearn-pandasBridges pandas DataFrames and scikit-learn by…
permissive · top 15,000 on PyPI
skopsSkops provides secure persistence and model…
unclear · top 5,000 on PyPI
datasieveDataSieve extends scikit-learn's Pipeline to…
permissive · top 15,000 on PyPI
sklearn-compatProvides backward-compatible wrappers for…
permissive · top 5,000 on PyPI
sklearn2pmmlConverts fitted Scikit-Learn pipelines to PMML…
agpl · top 15,000 on PyPI
sklearn-crfsuitesklearn-crfsuite wraps CRFsuite (Conditional…
permissive · top 15,000 on PyPI
scikit-learn-stubsProvides type stubs for scikit-learn to enable…
permissive · top 15,000 on PyPI
sagemaker-scikit-learn-extensionExtends scikit-learn with additional estimators…
permissive · top 15,000 on PyPI
category-encodersTransforms categorical variables into numeric…
permissive · top 5,000 on PyPI